Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-app / setup.py @ 0d069390

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 c1b7f449 Christos Stavrakakis
import sys
40 05f6d5c0 chazapis
41 05f6d5c0 chazapis
from distutils.util import convert_path
42 8c306eab Kostas Papadimitriou
from fnmatch import fnmatchcase
43 1ad8831f root
from setuptools import setup, find_packages
44 8c306eab Kostas Papadimitriou
45 8c306eab Kostas Papadimitriou
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
46 f5d58753 Kostas Papadimitriou
47 8c306eab Kostas Papadimitriou
from pithos.api.version import __version__
48 8c306eab Kostas Papadimitriou
49 8c306eab Kostas Papadimitriou
# Package info
50 8c306eab Kostas Papadimitriou
VERSION = __version__
51 3eea2bc3 Constantinos Venetsanopoulos
SHORT_DESCRIPTION = 'Synnefo File/Object Storage component'
52 1ad8831f root
53 8c306eab Kostas Papadimitriou
PACKAGES_ROOT = '.'
54 8c306eab Kostas Papadimitriou
PACKAGES = find_packages(PACKAGES_ROOT)
55 5a96180b Antony Chazapis
56 8c306eab Kostas Papadimitriou
# Package meta
57 8c306eab Kostas Papadimitriou
CLASSIFIERS = []
58 5a96180b Antony Chazapis
59 8c306eab Kostas Papadimitriou
# Package requirements
60 5a96180b Antony Chazapis
INSTALL_REQUIRES = [
61 8f63a115 Christos Stavrakakis
    'snf-common',
62 8f63a115 Christos Stavrakakis
    'snf-pithos-backend',
63 6b256427 Christos Stavrakakis
    'Django>=1.4, <1.5',
64 c1b7f449 Christos Stavrakakis
    'objpool>=0.3',
65 e6fb591c Ilias Tsitsimpis
    'astakosclient',
66 4b355d71 Christos Stavrakakis
    'snf-django-lib',
67 54046363 Georgios D. Tsoukalas
    'snf-webproject',
68 54046363 Georgios D. Tsoukalas
    'snf-branding',
69 5a96180b Antony Chazapis
]
70 f2d7b5ab Antony Chazapis
71 8c306eab Kostas Papadimitriou
EXTRAS_REQUIRES = {
72 8c306eab Kostas Papadimitriou
}
73 8c306eab Kostas Papadimitriou
74 8c306eab Kostas Papadimitriou
TESTS_REQUIRES = [
75 8c306eab Kostas Papadimitriou
]
76 05f6d5c0 chazapis
77 8c306eab Kostas Papadimitriou
78 8c306eab Kostas Papadimitriou
# Provided as an attribute, so you can append to these instead
79 8c306eab Kostas Papadimitriou
# of replicating them:
80 8c306eab Kostas Papadimitriou
standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"]
81 8c306eab Kostas Papadimitriou
standard_exclude_directories = [
82 8c306eab Kostas Papadimitriou
    ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
83 8c306eab Kostas Papadimitriou
]
84 05f6d5c0 chazapis
85 05f6d5c0 chazapis
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
86 05f6d5c0 chazapis
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
87 05f6d5c0 chazapis
# Note: you may want to copy this into your setup.py file verbatim, as
88 05f6d5c0 chazapis
# you can't import this from another package, when you don't know if
89 05f6d5c0 chazapis
# that package is installed yet.
90 2715ade4 Sofia Papagiannaki
91 2715ade4 Sofia Papagiannaki
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 2715ade4 Sofia Papagiannaki
        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 2715ade4 Sofia Papagiannaki
                            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 2715ade4 Sofia Papagiannaki
                        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 2715ade4 Sofia Papagiannaki
                    stack.append(
153 2715ade4 Sofia Papagiannaki
                        (fn, prefix + name + "/", package, only_in_packages))
154 05f6d5c0 chazapis
            elif package or not only_in_packages:
155 05f6d5c0 chazapis
                # is a file
156 05f6d5c0 chazapis
                bad_name = False
157 05f6d5c0 chazapis
                for pattern in exclude:
158 05f6d5c0 chazapis
                    if (fnmatchcase(name, pattern)
159 2715ade4 Sofia Papagiannaki
                            or fn.lower() == pattern.lower()):
160 05f6d5c0 chazapis
                        bad_name = True
161 05f6d5c0 chazapis
                        if show_ignored:
162 05f6d5c0 chazapis
                            print >> sys.stderr, (
163 05f6d5c0 chazapis
                                "File %s ignored by pattern %s"
164 05f6d5c0 chazapis
                                % (fn, pattern))
165 05f6d5c0 chazapis
                        break
166 05f6d5c0 chazapis
                if bad_name:
167 05f6d5c0 chazapis
                    continue
168 2715ade4 Sofia Papagiannaki
                out.setdefault(package, []).append(prefix + name)
169 05f6d5c0 chazapis
    return out
170 05f6d5c0 chazapis
171 f2d7b5ab Antony Chazapis
setup(
172 2715ade4 Sofia Papagiannaki
    name='snf-pithos-app',
173 2715ade4 Sofia Papagiannaki
    version=VERSION,
174 2715ade4 Sofia Papagiannaki
    license='BSD',
175 5adcc57e Christos Stavrakakis
    url='http://www.synnefo.org/',
176 2715ade4 Sofia Papagiannaki
    description=SHORT_DESCRIPTION,
177 2715ade4 Sofia Papagiannaki
    classifiers=CLASSIFIERS,
178 2715ade4 Sofia Papagiannaki
179 5adcc57e Christos Stavrakakis
    author='Synnefo development team',
180 5adcc57e Christos Stavrakakis
    author_email='synnefo-devel@googlegroups.com',
181 5adcc57e Christos Stavrakakis
    maintainer='Synnefo development team',
182 5adcc57e Christos Stavrakakis
    maintainer_email='synnefo-devel@googlegroups.com',
183 2715ade4 Sofia Papagiannaki
184 2715ade4 Sofia Papagiannaki
    namespace_packages=['pithos'],
185 2715ade4 Sofia Papagiannaki
    packages=PACKAGES,
186 2715ade4 Sofia Papagiannaki
    package_dir={'': PACKAGES_ROOT},
187 2715ade4 Sofia Papagiannaki
    include_package_data=True,
188 2715ade4 Sofia Papagiannaki
    package_data=find_package_data('.'),
189 2715ade4 Sofia Papagiannaki
    zip_safe=False,
190 2715ade4 Sofia Papagiannaki
191 3eea2bc3 Constantinos Venetsanopoulos
    dependency_links=['http://www.synnefo.org/packages/pypi'],
192 8c306eab Kostas Papadimitriou
193 2715ade4 Sofia Papagiannaki
    install_requires=INSTALL_REQUIRES,
194 2715ade4 Sofia Papagiannaki
    extras_require=EXTRAS_REQUIRES,
195 2715ade4 Sofia Papagiannaki
    tests_require=TESTS_REQUIRES,
196 2715ade4 Sofia Papagiannaki
197 2715ade4 Sofia Papagiannaki
    entry_points={
198 2715ade4 Sofia Papagiannaki
        'console_scripts': [
199 ae6199c5 Sofia Papagiannaki
            'pithos-manage-accounts = pithos.api.manage_accounts.cli:main'
200 2715ade4 Sofia Papagiannaki
        ],
201 2715ade4 Sofia Papagiannaki
        'synnefo': [
202 2715ade4 Sofia Papagiannaki
            'default_settings = pithos.api.synnefo_settings',
203 2715ade4 Sofia Papagiannaki
            'web_apps = pithos.api.synnefo_settings:synnefo_installed_apps',
204 2715ade4 Sofia Papagiannaki
            'web_middleware = pithos.api.synnefo_settings:synnefo_middlewares',
205 66643114 Sofia Papagiannaki
            'urls = pithos.api.urls:urlpatterns'
206 2715ade4 Sofia Papagiannaki
        ]
207 2715ade4 Sofia Papagiannaki
    },
208 f2d7b5ab Antony Chazapis
)