Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-app / setup.py @ dfb1fafa

History | View | Annotate | Download (7.1 kB)

1 05f6d5c0 chazapis
# Copyright 2011 GRNET S.A. All rights reserved.
2 05f6d5c0 chazapis
#
3 05f6d5c0 chazapis
# Redistribution and use in source and binary forms, with or
4 05f6d5c0 chazapis
# without modification, are permitted provided that the following
5 05f6d5c0 chazapis
# conditions are met:
6 05f6d5c0 chazapis
#
7 05f6d5c0 chazapis
#   1. Redistributions of source code must retain the above
8 05f6d5c0 chazapis
#      copyright notice, this list of conditions and the following
9 05f6d5c0 chazapis
#      disclaimer.
10 05f6d5c0 chazapis
#
11 05f6d5c0 chazapis
#   2. Redistributions in binary form must reproduce the above
12 05f6d5c0 chazapis
#      copyright notice, this list of conditions and the following
13 05f6d5c0 chazapis
#      disclaimer in the documentation and/or other materials
14 05f6d5c0 chazapis
#      provided with the distribution.
15 05f6d5c0 chazapis
#
16 05f6d5c0 chazapis
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 05f6d5c0 chazapis
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 05f6d5c0 chazapis
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 05f6d5c0 chazapis
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 05f6d5c0 chazapis
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 05f6d5c0 chazapis
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 05f6d5c0 chazapis
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 05f6d5c0 chazapis
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 05f6d5c0 chazapis
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 05f6d5c0 chazapis
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 05f6d5c0 chazapis
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 05f6d5c0 chazapis
# POSSIBILITY OF SUCH DAMAGE.
28 05f6d5c0 chazapis
#
29 05f6d5c0 chazapis
# The views and conclusions contained in the software and
30 05f6d5c0 chazapis
# documentation are those of the authors and should not be
31 05f6d5c0 chazapis
# interpreted as representing official policies, either expressed
32 05f6d5c0 chazapis
# or implied, of GRNET S.A.
33 8c306eab Kostas Papadimitriou
#
34 8c306eab Kostas Papadimitriou
35 8c306eab Kostas Papadimitriou
import distribute_setup
36 8c306eab Kostas Papadimitriou
distribute_setup.use_setuptools()
37 05f6d5c0 chazapis
38 1ad8831f root
import os
39 05f6d5c0 chazapis
40 05f6d5c0 chazapis
from distutils.util import convert_path
41 8c306eab Kostas Papadimitriou
from fnmatch import fnmatchcase
42 1ad8831f root
from setuptools import setup, find_packages
43 8c306eab Kostas Papadimitriou
44 8c306eab Kostas Papadimitriou
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
45 f5d58753 Kostas Papadimitriou
try:
46 f5d58753 Kostas Papadimitriou
    # try to update the version file
47 f5d58753 Kostas Papadimitriou
    from synnefo.util import version
48 f5d58753 Kostas Papadimitriou
    version.update_version('pithos.api', 'version', HERE)
49 f5d58753 Kostas Papadimitriou
except ImportError:
50 f5d58753 Kostas Papadimitriou
    pass
51 f5d58753 Kostas Papadimitriou
52 8c306eab Kostas Papadimitriou
from pithos.api.version import __version__
53 8c306eab Kostas Papadimitriou
54 8c306eab Kostas Papadimitriou
# Package info
55 8c306eab Kostas Papadimitriou
VERSION = __version__
56 8c306eab Kostas Papadimitriou
README = open(os.path.join(HERE, 'README')).read()
57 8c306eab Kostas Papadimitriou
CHANGES = open(os.path.join(HERE, 'Changelog')).read()
58 8c306eab Kostas Papadimitriou
SHORT_DESCRIPTION = 'Package short description'
59 1ad8831f root
60 8c306eab Kostas Papadimitriou
PACKAGES_ROOT = '.'
61 8c306eab Kostas Papadimitriou
PACKAGES = find_packages(PACKAGES_ROOT)
62 5a96180b Antony Chazapis
63 8c306eab Kostas Papadimitriou
# Package meta
64 8c306eab Kostas Papadimitriou
CLASSIFIERS = []
65 5a96180b Antony Chazapis
66 8c306eab Kostas Papadimitriou
# Package requirements
67 5a96180b Antony Chazapis
INSTALL_REQUIRES = [
68 4f60d358 Kostas Papadimitriou
    'snf-common>=0.9.0rc',
69 63d04430 Kostas Papadimitriou
    'snf-pithos-backend>=0.9.1',
70 9f83917d Antony Chazapis
    'Django>=1.2, <1.3'
71 5a96180b Antony Chazapis
]
72 f2d7b5ab Antony Chazapis
73 8c306eab Kostas Papadimitriou
EXTRAS_REQUIRES = {
74 8c306eab Kostas Papadimitriou
}
75 8c306eab Kostas Papadimitriou
76 8c306eab Kostas Papadimitriou
TESTS_REQUIRES = [
77 8c306eab Kostas Papadimitriou
]
78 05f6d5c0 chazapis
79 8c306eab Kostas Papadimitriou
80 8c306eab Kostas Papadimitriou
# Provided as an attribute, so you can append to these instead
81 8c306eab Kostas Papadimitriou
# of replicating them:
82 8c306eab Kostas Papadimitriou
standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"]
83 8c306eab Kostas Papadimitriou
standard_exclude_directories = [
84 8c306eab Kostas Papadimitriou
    ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
85 8c306eab Kostas Papadimitriou
]
86 05f6d5c0 chazapis
87 05f6d5c0 chazapis
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
88 05f6d5c0 chazapis
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
89 05f6d5c0 chazapis
# Note: you may want to copy this into your setup.py file verbatim, as
90 05f6d5c0 chazapis
# you can't import this from another package, when you don't know if
91 05f6d5c0 chazapis
# that package is installed yet.
92 05f6d5c0 chazapis
def find_package_data(
93 8c306eab Kostas Papadimitriou
    where=".",
94 8c306eab Kostas Papadimitriou
    package="",
95 05f6d5c0 chazapis
    exclude=standard_exclude,
96 05f6d5c0 chazapis
    exclude_directories=standard_exclude_directories,
97 05f6d5c0 chazapis
    only_in_packages=True,
98 05f6d5c0 chazapis
    show_ignored=False):
99 05f6d5c0 chazapis
    """
100 05f6d5c0 chazapis
    Return a dictionary suitable for use in ``package_data``
101 05f6d5c0 chazapis
    in a distutils ``setup.py`` file.
102 05f6d5c0 chazapis

103 05f6d5c0 chazapis
    The dictionary looks like::
104 05f6d5c0 chazapis

105 8c306eab Kostas Papadimitriou
        {"package": [files]}
106 05f6d5c0 chazapis

107 05f6d5c0 chazapis
    Where ``files`` is a list of all the files in that package that
108 8c306eab Kostas Papadimitriou
    don"t match anything in ``exclude``.
109 05f6d5c0 chazapis

110 05f6d5c0 chazapis
    If ``only_in_packages`` is true, then top-level directories that
111 8c306eab Kostas Papadimitriou
    are not packages won"t be included (but directories under packages
112 05f6d5c0 chazapis
    will).
113 05f6d5c0 chazapis

114 05f6d5c0 chazapis
    Directories matching any pattern in ``exclude_directories`` will
115 05f6d5c0 chazapis
    be ignored; by default directories with leading ``.``, ``CVS``,
116 05f6d5c0 chazapis
    and ``_darcs`` will be ignored.
117 05f6d5c0 chazapis

118 8c306eab Kostas Papadimitriou
    If ``show_ignored`` is true, then all the files that aren"t
119 05f6d5c0 chazapis
    included in package data are shown on stderr (for debugging
120 05f6d5c0 chazapis
    purposes).
121 05f6d5c0 chazapis

122 05f6d5c0 chazapis
    Note patterns use wildcards, or can be exact paths (including
123 05f6d5c0 chazapis
    leading ``./``), and all searching is case-insensitive.
124 05f6d5c0 chazapis
    """
125 05f6d5c0 chazapis
    out = {}
126 8c306eab Kostas Papadimitriou
    stack = [(convert_path(where), "", package, only_in_packages)]
127 05f6d5c0 chazapis
    while stack:
128 05f6d5c0 chazapis
        where, prefix, package, only_in_packages = stack.pop(0)
129 05f6d5c0 chazapis
        for name in os.listdir(where):
130 05f6d5c0 chazapis
            fn = os.path.join(where, name)
131 05f6d5c0 chazapis
            if os.path.isdir(fn):
132 05f6d5c0 chazapis
                bad_name = False
133 05f6d5c0 chazapis
                for pattern in exclude_directories:
134 05f6d5c0 chazapis
                    if (fnmatchcase(name, pattern)
135 05f6d5c0 chazapis
                        or fn.lower() == pattern.lower()):
136 05f6d5c0 chazapis
                        bad_name = True
137 05f6d5c0 chazapis
                        if show_ignored:
138 05f6d5c0 chazapis
                            print >> sys.stderr, (
139 05f6d5c0 chazapis
                                "Directory %s ignored by pattern %s"
140 05f6d5c0 chazapis
                                % (fn, pattern))
141 05f6d5c0 chazapis
                        break
142 05f6d5c0 chazapis
                if bad_name:
143 05f6d5c0 chazapis
                    continue
144 8c306eab Kostas Papadimitriou
                if (os.path.isfile(os.path.join(fn, "__init__.py"))
145 05f6d5c0 chazapis
                    and not prefix):
146 05f6d5c0 chazapis
                    if not package:
147 05f6d5c0 chazapis
                        new_package = name
148 05f6d5c0 chazapis
                    else:
149 8c306eab Kostas Papadimitriou
                        new_package = package + "." + name
150 8c306eab Kostas Papadimitriou
                    stack.append((fn, "", new_package, False))
151 05f6d5c0 chazapis
                else:
152 8c306eab Kostas Papadimitriou
                    stack.append((fn, prefix + name + "/", package, only_in_packages))
153 05f6d5c0 chazapis
            elif package or not only_in_packages:
154 05f6d5c0 chazapis
                # is a file
155 05f6d5c0 chazapis
                bad_name = False
156 05f6d5c0 chazapis
                for pattern in exclude:
157 05f6d5c0 chazapis
                    if (fnmatchcase(name, pattern)
158 05f6d5c0 chazapis
                        or fn.lower() == pattern.lower()):
159 05f6d5c0 chazapis
                        bad_name = True
160 05f6d5c0 chazapis
                        if show_ignored:
161 05f6d5c0 chazapis
                            print >> sys.stderr, (
162 05f6d5c0 chazapis
                                "File %s ignored by pattern %s"
163 05f6d5c0 chazapis
                                % (fn, pattern))
164 05f6d5c0 chazapis
                        break
165 05f6d5c0 chazapis
                if bad_name:
166 05f6d5c0 chazapis
                    continue
167 05f6d5c0 chazapis
                out.setdefault(package, []).append(prefix+name)
168 05f6d5c0 chazapis
    return out
169 05f6d5c0 chazapis
170 f2d7b5ab Antony Chazapis
setup(
171 8c306eab Kostas Papadimitriou
    name = 'snf-pithos-app',
172 8c306eab Kostas Papadimitriou
    version = VERSION,
173 8c306eab Kostas Papadimitriou
    license = 'BSD',
174 8c306eab Kostas Papadimitriou
    url = 'http://code.grnet.gr/',
175 8c306eab Kostas Papadimitriou
    description = SHORT_DESCRIPTION,
176 8c306eab Kostas Papadimitriou
    long_description=README + '\n\n' +  CHANGES,
177 8c306eab Kostas Papadimitriou
    classifiers = CLASSIFIERS,
178 8c306eab Kostas Papadimitriou
179 8c306eab Kostas Papadimitriou
    author = 'Package author',
180 8c306eab Kostas Papadimitriou
    author_email = 'author@grnet.gr',
181 8c306eab Kostas Papadimitriou
    maintainer = 'Package maintainer',
182 8c306eab Kostas Papadimitriou
    maintainer_email = 'maintainer@grnet.gr',
183 8c306eab Kostas Papadimitriou
184 8c306eab Kostas Papadimitriou
    namespace_packages = ['pithos'],
185 8c306eab Kostas Papadimitriou
    packages = PACKAGES,
186 8c306eab Kostas Papadimitriou
    package_dir= {'': PACKAGES_ROOT},
187 8c306eab Kostas Papadimitriou
    include_package_data = True,
188 8c306eab Kostas Papadimitriou
    package_data = find_package_data('.'),
189 8c306eab Kostas Papadimitriou
    zip_safe = False,
190 8c306eab Kostas Papadimitriou
191 8c306eab Kostas Papadimitriou
    dependency_links = [
192 bd9f302a Kostas Papadimitriou
        'http://docs.dev.grnet.gr/pypi/'],
193 8c306eab Kostas Papadimitriou
194 8c306eab Kostas Papadimitriou
    install_requires = INSTALL_REQUIRES,
195 8c306eab Kostas Papadimitriou
    extras_require = EXTRAS_REQUIRES,
196 8c306eab Kostas Papadimitriou
    tests_require = TESTS_REQUIRES,
197 8c306eab Kostas Papadimitriou
198 8c306eab Kostas Papadimitriou
    entry_points = {
199 8c306eab Kostas Papadimitriou
     'console_scripts': [
200 8c306eab Kostas Papadimitriou
         ],
201 8c306eab Kostas Papadimitriou
     'synnefo': [
202 b2d77f0e Kostas Papadimitriou
         'default_settings = pithos.api.synnefo_settings',
203 b2d77f0e Kostas Papadimitriou
         'web_apps = pithos.api.synnefo_settings:synnefo_installed_apps',
204 b2d77f0e Kostas Papadimitriou
         'web_middleware = pithos.api.synnefo_settings:synnefo_middlewares',
205 b2d77f0e Kostas Papadimitriou
         'urls = pithos.api.urls:urlpatterns',
206 0262f83f Kostas Papadimitriou
         'loggers = pithos.api.synnefo_settings:loggers'
207 8c306eab Kostas Papadimitriou
         ]
208 8c306eab Kostas Papadimitriou
      },
209 f2d7b5ab Antony Chazapis
)