Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / setup.py @ 4b355d71

History | View | Annotate | Download (7.2 kB)

1
#!/usr/bin/env python
2

    
3
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
#
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
#
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
#
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
#
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35
import distribute_setup
36
distribute_setup.use_setuptools()
37

    
38
import os
39
import sys
40

    
41
from fnmatch import fnmatchcase
42
from distutils.util import convert_path
43

    
44
from setuptools import setup, find_packages
45

    
46
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
47

    
48
from astakos.version import __version__
49

    
50
# Package info
51
VERSION = __version__
52
README = open(os.path.join(HERE, 'README')).read()
53
SHORT_DESCRIPTION = 'Synnefo Identity Management component'
54

    
55
PACKAGES_ROOT = '.'
56
PACKAGES = find_packages(PACKAGES_ROOT)
57

    
58
# Package meta
59
CLASSIFIERS = [
60
    'Development Status :: 3 - Alpha',
61
    'Operating System :: OS Independent',
62
    'Programming Language :: Python',
63
    'Topic :: Utilities',
64
    'License :: OSI Approved :: BSD License',
65
]
66

    
67
# Package requirements
68
INSTALL_REQUIRES = [
69
    'Django>=1.2, <1.3',
70
    'South>=0.7, <=0.7.3',
71
    'httplib2>=0.6.0',
72
    'snf-common',
73
    'django-tables2',
74
    'recaptcha-client>=1.0.5',
75
    'django-ratelimit==0.1',
76
    'requests',
77
    'inflect',
78
    'snf-django-lib',
79
]
80

    
81
EXTRAS_REQUIRES = {
82
}
83

    
84
TESTS_REQUIRES = [
85
]
86

    
87
# Provided as an attribute, so you can append to these instead
88
# of replicating them:
89
standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"]
90
standard_exclude_directories = [
91
    ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
92
]
93

    
94
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
95
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
96
# Note: you may want to copy this into your setup.py file verbatim, as
97
# you can't import this from another package, when you don't know if
98
# that package is installed yet.
99

    
100

    
101
def find_package_data(
102
    where=".",
103
    package="",
104
    exclude=standard_exclude,
105
    exclude_directories=standard_exclude_directories,
106
    only_in_packages=True,
107
        show_ignored=False):
108
    """
109
    Return a dictionary suitable for use in ``package_data``
110
    in a distutils ``setup.py`` file.
111

112
    The dictionary looks like::
113

114
        {"package": [files]}
115

116
    Where ``files`` is a list of all the files in that package that
117
    don"t match anything in ``exclude``.
118

119
    If ``only_in_packages`` is true, then top-level directories that
120
    are not packages won"t be included (but directories under packages
121
    will).
122

123
    Directories matching any pattern in ``exclude_directories`` will
124
    be ignored; by default directories with leading ``.``, ``CVS``,
125
    and ``_darcs`` will be ignored.
126

127
    If ``show_ignored`` is true, then all the files that aren"t
128
    included in package data are shown on stderr (for debugging
129
    purposes).
130

131
    Note patterns use wildcards, or can be exact paths (including
132
    leading ``./``), and all searching is case-insensitive.
133
    """
134
    out = {}
135
    stack = [(convert_path(where), "", package, only_in_packages)]
136
    while stack:
137
        where, prefix, package, only_in_packages = stack.pop(0)
138
        for name in os.listdir(where):
139
            fn = os.path.join(where, name)
140
            if os.path.isdir(fn):
141
                bad_name = False
142
                for pattern in exclude_directories:
143
                    if (fnmatchcase(name, pattern)
144
                            or fn.lower() == pattern.lower()):
145
                        bad_name = True
146
                        if show_ignored:
147
                            print >> sys.stderr, (
148
                                "Directory %s ignored by pattern %s"
149
                                % (fn, pattern))
150
                        break
151
                if bad_name:
152
                    continue
153
                if (os.path.isfile(os.path.join(fn, "__init__.py"))
154
                        and not prefix):
155
                    if not package:
156
                        new_package = name
157
                    else:
158
                        new_package = package + "." + name
159
                    stack.append((fn, "", new_package, False))
160
                else:
161
                    stack.append(
162
                        (fn, prefix + name + "/", package, only_in_packages))
163
            elif package or not only_in_packages:
164
                # is a file
165
                bad_name = False
166
                for pattern in exclude:
167
                    if (fnmatchcase(name, pattern)
168
                            or fn.lower() == pattern.lower()):
169
                        bad_name = True
170
                        if show_ignored:
171
                            print >> sys.stderr, (
172
                                "File %s ignored by pattern %s"
173
                                % (fn, pattern))
174
                        break
175
                if bad_name:
176
                    continue
177
                out.setdefault(package, []).append(prefix + name)
178
    return out
179

    
180
setup(
181
    name='snf-astakos-app',
182
    version=VERSION,
183
    license='BSD',
184
    url='http://www.synnefo.org/',
185
    description=SHORT_DESCRIPTION,
186
    long_description=README,
187
    classifiers=CLASSIFIERS,
188

    
189
    author='Synnefo development team',
190
    author_email='synnefo-devel@googlegroups.com',
191
    maintainer='Synnefo development team',
192
    maintainer_email='synnefo-devel@googlegroups.com',
193

    
194
    packages=find_packages(),
195
    include_package_data=True,
196
    package_data=find_package_data('.'),
197
    zip_safe=False,
198

    
199
    install_requires=INSTALL_REQUIRES,
200

    
201
    dependency_links=['http://www.synnefo.org/packages/pypi'],
202

    
203
    entry_points={
204
        'synnefo': [
205
            'default_settings = astakos.im.synnefo_settings',
206
            'web_apps = astakos.im.synnefo_settings:installed_apps',
207
            'web_middleware = astakos.im.synnefo_settings:middlware_classes',
208
            'web_context_processors = astakos.im.synnefo_settings:context_processors',
209
            'urls = astakos.urls:urlpatterns',
210
            'web_static = astakos.im.synnefo_settings:static_files'
211
        ]
212
    }
213
)