Statistics
| Branch: | Tag: | Revision:

root / setup.py @ d63539ef

History | View | Annotate | Download (4.5 kB)

1
import os
2
import sys
3

    
4
from fnmatch import fnmatchcase
5
from distutils.util import convert_path
6
from setuptools import setup, find_packages
7

    
8
INSTALL_REQUIRES = [
9
    'Django >=1.2.3, <1.3',
10
    'South==0.7',
11
    'snf-webproject',
12
    'feincms >=1.4.2, < 1.5'
13
]
14
CLASSIFIERS = []
15

    
16

    
17
# Provided as an attribute, so you can append to these instead
18
# of replicating them:
19
standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
20
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
21
                                './dist', 'EGG-INFO', '*.egg-info')
22

    
23
def find_package_data(
24
    where='.', package='',
25
    exclude=standard_exclude,
26
    exclude_directories=standard_exclude_directories,
27
    only_in_packages=True,
28
    show_ignored=False):
29
    """
30
    Return a dictionary suitable for use in ``package_data``
31
    in a distutils ``setup.py`` file.
32

33
    The dictionary looks like::
34

35
        {'package': [files]}
36

37
    Where ``files`` is a list of all the files in that package that
38
    don't match anything in ``exclude``.
39

40
    If ``only_in_packages`` is true, then top-level directories that
41
    are not packages won't be included (but directories under packages
42
    will).
43

44
    Directories matching any pattern in ``exclude_directories`` will
45
    be ignored; by default directories with leading ``.``, ``CVS``,
46
    and ``_darcs`` will be ignored.
47

48
    If ``show_ignored`` is true, then all the files that aren't
49
    included in package data are shown on stderr (for debugging
50
    purposes).
51

52
    Note patterns use wildcards, or can be exact paths (including
53
    leading ``./``), and all searching is case-insensitive.
54
    """
55

    
56
    out = {}
57
    stack = [(convert_path(where), '', package, only_in_packages)]
58
    while stack:
59
        where, prefix, package, only_in_packages = stack.pop(0)
60
        for name in os.listdir(where):
61
            fn = os.path.join(where, name)
62
            if os.path.isdir(fn):
63
                bad_name = False
64
                for pattern in exclude_directories:
65
                    if (fnmatchcase(name, pattern)
66
                        or fn.lower() == pattern.lower()):
67
                        bad_name = True
68
                        if show_ignored:
69
                            print >> sys.stderr, (
70
                                "Directory %s ignored by pattern %s"
71
                                % (fn, pattern))
72
                        break
73
                if bad_name:
74
                    continue
75
                if (os.path.isfile(os.path.join(fn, '__init__.py'))
76
                    and not prefix):
77
                    if not package:
78
                        new_package = name
79
                    else:
80
                        new_package = package + '.' + name
81
                    stack.append((fn, '', new_package, False))
82
                else:
83
                    stack.append((fn, prefix + name + '/', package, only_in_packages))
84
            elif package or not only_in_packages:
85
                # is a file
86
                bad_name = False
87
                for pattern in exclude:
88
                    if (fnmatchcase(name, pattern)
89
                        or fn.lower() == pattern.lower()):
90
                        bad_name = True
91
                        if show_ignored:
92
                            print >> sys.stderr, (
93
                                "File %s ignored by pattern %s"
94
                                % (fn, pattern))
95
                        break
96
                if bad_name:
97
                    continue
98
                out.setdefault(package, []).append(prefix+name)
99
    return out
100

    
101
from cloudcms import version
102
VERSION = version.__version__
103

    
104
setup(
105
    name = 'snf-cloudcms',
106
    version = VERSION,
107
    license = 'BSD',
108
    url = 'http://code.grnet.gr/',
109
    classifiers = CLASSIFIERS,
110

    
111
    author = 'Package author',
112
    author_email = 'author@grnet.gr',
113
    maintainer = 'Package maintainer',
114
    maintainer_email = 'maintainer@grnet.gr',
115

    
116
    packages = find_packages('.'),
117
    package_dir= {'': '.'},
118
    include_package_data = True,
119
    package_data=find_package_data('.'),
120
    zip_safe = False,
121

    
122
    install_requires = INSTALL_REQUIRES,
123

    
124
    dependency_links = ['http://docs.dev.grnet.gr/pypi'],
125

    
126
    entry_points = {
127
     'synnefo': [
128
         'default_settings = cloudcms.synnefo_settings',
129
         'web_apps = cloudcms.synnefo_settings:CLOUDCMS_APPS',
130
         'web_middleware = cloudcms.synnefo_settings:CLOUDCMS_MIDDLEWARES',
131
         'web_context_processors = cloudcms.synnefo_settings:CLOUDCMS_CONTEXT_PROCESSORS',
132
         'urls = cloudcms.urls:urlpatterns',
133
         'web_static = cloudcms.synnefo_settings:CLOUDCMS_STATICFILES'
134
         ]
135
    },
136

    
137
)
138