Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (7 kB)

1 3eea2bc3 Constantinos Venetsanopoulos
# Copyright 2011, 2012, 2013 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
46 8c306eab Kostas Papadimitriou
from pithos.api.version import __version__
47 8c306eab Kostas Papadimitriou
48 8c306eab Kostas Papadimitriou
# Package info
49 8c306eab Kostas Papadimitriou
VERSION = __version__
50 3eea2bc3 Constantinos Venetsanopoulos
SHORT_DESCRIPTION = 'Synnefo File/Object Storage component'
51 1ad8831f root
52 8c306eab Kostas Papadimitriou
PACKAGES_ROOT = '.'
53 8c306eab Kostas Papadimitriou
PACKAGES = find_packages(PACKAGES_ROOT)
54 5a96180b Antony Chazapis
55 8c306eab Kostas Papadimitriou
# Package meta
56 8c306eab Kostas Papadimitriou
CLASSIFIERS = []
57 5a96180b Antony Chazapis
58 8c306eab Kostas Papadimitriou
# Package requirements
59 5a96180b Antony Chazapis
INSTALL_REQUIRES = [
60 8f63a115 Christos Stavrakakis
    'snf-common',
61 8f63a115 Christos Stavrakakis
    'snf-pithos-backend',
62 1a736ca8 Christos Stavrakakis
    'Django>=1.2, <1.3',
63 4b355d71 Christos Stavrakakis
    'objpool>=0.2',
64 e6fb591c Ilias Tsitsimpis
    'astakosclient',
65 4b355d71 Christos Stavrakakis
    'snf-django-lib',
66 54046363 Georgios D. Tsoukalas
    'snf-webproject',
67 54046363 Georgios D. Tsoukalas
    'snf-branding',
68 5a96180b Antony Chazapis
]
69 f2d7b5ab Antony Chazapis
70 8c306eab Kostas Papadimitriou
EXTRAS_REQUIRES = {
71 8c306eab Kostas Papadimitriou
}
72 8c306eab Kostas Papadimitriou
73 8c306eab Kostas Papadimitriou
TESTS_REQUIRES = [
74 8c306eab Kostas Papadimitriou
]
75 05f6d5c0 chazapis
76 8c306eab Kostas Papadimitriou
77 8c306eab Kostas Papadimitriou
# Provided as an attribute, so you can append to these instead
78 8c306eab Kostas Papadimitriou
# of replicating them:
79 8c306eab Kostas Papadimitriou
standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"]
80 8c306eab Kostas Papadimitriou
standard_exclude_directories = [
81 8c306eab Kostas Papadimitriou
    ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
82 8c306eab Kostas Papadimitriou
]
83 05f6d5c0 chazapis
84 05f6d5c0 chazapis
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
85 05f6d5c0 chazapis
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
86 05f6d5c0 chazapis
# Note: you may want to copy this into your setup.py file verbatim, as
87 05f6d5c0 chazapis
# you can't import this from another package, when you don't know if
88 05f6d5c0 chazapis
# that package is installed yet.
89 2715ade4 Sofia Papagiannaki
90 2715ade4 Sofia Papagiannaki
91 05f6d5c0 chazapis
def find_package_data(
92 8c306eab Kostas Papadimitriou
    where=".",
93 8c306eab Kostas Papadimitriou
    package="",
94 05f6d5c0 chazapis
    exclude=standard_exclude,
95 05f6d5c0 chazapis
    exclude_directories=standard_exclude_directories,
96 05f6d5c0 chazapis
    only_in_packages=True,
97 2715ade4 Sofia Papagiannaki
        show_ignored=False):
98 05f6d5c0 chazapis
    """
99 05f6d5c0 chazapis
    Return a dictionary suitable for use in ``package_data``
100 05f6d5c0 chazapis
    in a distutils ``setup.py`` file.
101 05f6d5c0 chazapis

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

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

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

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

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

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

121 05f6d5c0 chazapis
    Note patterns use wildcards, or can be exact paths (including
122 05f6d5c0 chazapis
    leading ``./``), and all searching is case-insensitive.
123 05f6d5c0 chazapis
    """
124 05f6d5c0 chazapis
    out = {}
125 8c306eab Kostas Papadimitriou
    stack = [(convert_path(where), "", package, only_in_packages)]
126 05f6d5c0 chazapis
    while stack:
127 05f6d5c0 chazapis
        where, prefix, package, only_in_packages = stack.pop(0)
128 05f6d5c0 chazapis
        for name in os.listdir(where):
129 05f6d5c0 chazapis
            fn = os.path.join(where, name)
130 05f6d5c0 chazapis
            if os.path.isdir(fn):
131 05f6d5c0 chazapis
                bad_name = False
132 05f6d5c0 chazapis
                for pattern in exclude_directories:
133 05f6d5c0 chazapis
                    if (fnmatchcase(name, pattern)
134 2715ade4 Sofia Papagiannaki
                            or fn.lower() == pattern.lower()):
135 05f6d5c0 chazapis
                        bad_name = True
136 05f6d5c0 chazapis
                        if show_ignored:
137 05f6d5c0 chazapis
                            print >> sys.stderr, (
138 05f6d5c0 chazapis
                                "Directory %s ignored by pattern %s"
139 05f6d5c0 chazapis
                                % (fn, pattern))
140 05f6d5c0 chazapis
                        break
141 05f6d5c0 chazapis
                if bad_name:
142 05f6d5c0 chazapis
                    continue
143 8c306eab Kostas Papadimitriou
                if (os.path.isfile(os.path.join(fn, "__init__.py"))
144 2715ade4 Sofia Papagiannaki
                        and not prefix):
145 05f6d5c0 chazapis
                    if not package:
146 05f6d5c0 chazapis
                        new_package = name
147 05f6d5c0 chazapis
                    else:
148 8c306eab Kostas Papadimitriou
                        new_package = package + "." + name
149 8c306eab Kostas Papadimitriou
                    stack.append((fn, "", new_package, False))
150 05f6d5c0 chazapis
                else:
151 2715ade4 Sofia Papagiannaki
                    stack.append(
152 2715ade4 Sofia Papagiannaki
                        (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 2715ade4 Sofia Papagiannaki
                            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 2715ade4 Sofia Papagiannaki
                out.setdefault(package, []).append(prefix + name)
168 05f6d5c0 chazapis
    return out
169 05f6d5c0 chazapis
170 f2d7b5ab Antony Chazapis
setup(
171 2715ade4 Sofia Papagiannaki
    name='snf-pithos-app',
172 2715ade4 Sofia Papagiannaki
    version=VERSION,
173 2715ade4 Sofia Papagiannaki
    license='BSD',
174 5adcc57e Christos Stavrakakis
    url='http://www.synnefo.org/',
175 2715ade4 Sofia Papagiannaki
    description=SHORT_DESCRIPTION,
176 2715ade4 Sofia Papagiannaki
    classifiers=CLASSIFIERS,
177 2715ade4 Sofia Papagiannaki
178 5adcc57e Christos Stavrakakis
    author='Synnefo development team',
179 5adcc57e Christos Stavrakakis
    author_email='synnefo-devel@googlegroups.com',
180 5adcc57e Christos Stavrakakis
    maintainer='Synnefo development team',
181 5adcc57e Christos Stavrakakis
    maintainer_email='synnefo-devel@googlegroups.com',
182 2715ade4 Sofia Papagiannaki
183 2715ade4 Sofia Papagiannaki
    namespace_packages=['pithos'],
184 2715ade4 Sofia Papagiannaki
    packages=PACKAGES,
185 2715ade4 Sofia Papagiannaki
    package_dir={'': PACKAGES_ROOT},
186 2715ade4 Sofia Papagiannaki
    include_package_data=True,
187 2715ade4 Sofia Papagiannaki
    package_data=find_package_data('.'),
188 2715ade4 Sofia Papagiannaki
    zip_safe=False,
189 2715ade4 Sofia Papagiannaki
190 3eea2bc3 Constantinos Venetsanopoulos
    dependency_links=['http://www.synnefo.org/packages/pypi'],
191 8c306eab Kostas Papadimitriou
192 2715ade4 Sofia Papagiannaki
    install_requires=INSTALL_REQUIRES,
193 2715ade4 Sofia Papagiannaki
    extras_require=EXTRAS_REQUIRES,
194 2715ade4 Sofia Papagiannaki
    tests_require=TESTS_REQUIRES,
195 2715ade4 Sofia Papagiannaki
196 2715ade4 Sofia Papagiannaki
    entry_points={
197 2715ade4 Sofia Papagiannaki
        'console_scripts': [
198 ae6199c5 Sofia Papagiannaki
            'pithos-manage-accounts = pithos.api.manage_accounts.cli:main'
199 2715ade4 Sofia Papagiannaki
        ],
200 2715ade4 Sofia Papagiannaki
        'synnefo': [
201 2715ade4 Sofia Papagiannaki
            'default_settings = pithos.api.synnefo_settings',
202 2715ade4 Sofia Papagiannaki
            'web_apps = pithos.api.synnefo_settings:synnefo_installed_apps',
203 2715ade4 Sofia Papagiannaki
            'web_middleware = pithos.api.synnefo_settings:synnefo_middlewares',
204 66643114 Sofia Papagiannaki
            'urls = pithos.api.urls:urlpatterns'
205 2715ade4 Sofia Papagiannaki
        ]
206 2715ade4 Sofia Papagiannaki
    },
207 f2d7b5ab Antony Chazapis
)