Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-backend / setup.py @ 809b482a

History | View | Annotate | Download (6.6 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 ee71c0d5 Kostas Papadimitriou
from pithos.backends.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 = 'Backend library for the 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 b672055f Ilias Tsitsimpis
    'SQLAlchemy>=0.6.3, <=0.7.8',
63 9c26045d Kostas Papadimitriou
    'alembic>=0.3.4, <0.4',
64 c1b7f449 Christos Stavrakakis
    'objpool>=0.3'
65 5a96180b Antony Chazapis
]
66 f2d7b5ab Antony Chazapis
67 8c306eab Kostas Papadimitriou
EXTRAS_REQUIRES = {
68 8c306eab Kostas Papadimitriou
}
69 8c306eab Kostas Papadimitriou
70 8c306eab Kostas Papadimitriou
TESTS_REQUIRES = [
71 8c306eab Kostas Papadimitriou
]
72 05f6d5c0 chazapis
73 8c306eab Kostas Papadimitriou
74 8c306eab Kostas Papadimitriou
# Provided as an attribute, so you can append to these instead
75 8c306eab Kostas Papadimitriou
# of replicating them:
76 58329afe Kostas Papadimitriou
standard_exclude = ["*.pyc", "*$py.class", "*~", ".*", "*.bak"]
77 8c306eab Kostas Papadimitriou
standard_exclude_directories = [
78 8c306eab Kostas Papadimitriou
    ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
79 8c306eab Kostas Papadimitriou
]
80 05f6d5c0 chazapis
81 05f6d5c0 chazapis
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
82 05f6d5c0 chazapis
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
83 05f6d5c0 chazapis
# Note: you may want to copy this into your setup.py file verbatim, as
84 05f6d5c0 chazapis
# you can't import this from another package, when you don't know if
85 05f6d5c0 chazapis
# that package is installed yet.
86 2715ade4 Sofia Papagiannaki
87 2715ade4 Sofia Papagiannaki
88 05f6d5c0 chazapis
def find_package_data(
89 8c306eab Kostas Papadimitriou
    where=".",
90 8c306eab Kostas Papadimitriou
    package="",
91 05f6d5c0 chazapis
    exclude=standard_exclude,
92 05f6d5c0 chazapis
    exclude_directories=standard_exclude_directories,
93 05f6d5c0 chazapis
    only_in_packages=True,
94 2715ade4 Sofia Papagiannaki
        show_ignored=False):
95 05f6d5c0 chazapis
    """
96 05f6d5c0 chazapis
    Return a dictionary suitable for use in ``package_data``
97 05f6d5c0 chazapis
    in a distutils ``setup.py`` file.
98 05f6d5c0 chazapis

99 05f6d5c0 chazapis
    The dictionary looks like::
100 05f6d5c0 chazapis

101 8c306eab Kostas Papadimitriou
        {"package": [files]}
102 05f6d5c0 chazapis

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

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

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

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

118 05f6d5c0 chazapis
    Note patterns use wildcards, or can be exact paths (including
119 05f6d5c0 chazapis
    leading ``./``), and all searching is case-insensitive.
120 05f6d5c0 chazapis
    """
121 05f6d5c0 chazapis
    out = {}
122 8c306eab Kostas Papadimitriou
    stack = [(convert_path(where), "", package, only_in_packages)]
123 05f6d5c0 chazapis
    while stack:
124 05f6d5c0 chazapis
        where, prefix, package, only_in_packages = stack.pop(0)
125 05f6d5c0 chazapis
        for name in os.listdir(where):
126 05f6d5c0 chazapis
            fn = os.path.join(where, name)
127 05f6d5c0 chazapis
            if os.path.isdir(fn):
128 05f6d5c0 chazapis
                bad_name = False
129 05f6d5c0 chazapis
                for pattern in exclude_directories:
130 05f6d5c0 chazapis
                    if (fnmatchcase(name, pattern)
131 2715ade4 Sofia Papagiannaki
                            or fn.lower() == pattern.lower()):
132 05f6d5c0 chazapis
                        bad_name = True
133 05f6d5c0 chazapis
                        if show_ignored:
134 05f6d5c0 chazapis
                            print >> sys.stderr, (
135 05f6d5c0 chazapis
                                "Directory %s ignored by pattern %s"
136 05f6d5c0 chazapis
                                % (fn, pattern))
137 05f6d5c0 chazapis
                        break
138 05f6d5c0 chazapis
                if bad_name:
139 05f6d5c0 chazapis
                    continue
140 8c306eab Kostas Papadimitriou
                if (os.path.isfile(os.path.join(fn, "__init__.py"))
141 2715ade4 Sofia Papagiannaki
                        and not prefix):
142 05f6d5c0 chazapis
                    if not package:
143 05f6d5c0 chazapis
                        new_package = name
144 05f6d5c0 chazapis
                    else:
145 8c306eab Kostas Papadimitriou
                        new_package = package + "." + name
146 8c306eab Kostas Papadimitriou
                    stack.append((fn, "", new_package, False))
147 05f6d5c0 chazapis
                else:
148 2715ade4 Sofia Papagiannaki
                    stack.append(
149 2715ade4 Sofia Papagiannaki
                        (fn, prefix + name + "/", package, only_in_packages))
150 05f6d5c0 chazapis
            elif package or not only_in_packages:
151 05f6d5c0 chazapis
                # is a file
152 05f6d5c0 chazapis
                bad_name = False
153 05f6d5c0 chazapis
                for pattern in exclude:
154 05f6d5c0 chazapis
                    if (fnmatchcase(name, pattern)
155 2715ade4 Sofia Papagiannaki
                            or fn.lower() == pattern.lower()):
156 05f6d5c0 chazapis
                        bad_name = True
157 05f6d5c0 chazapis
                        if show_ignored:
158 05f6d5c0 chazapis
                            print >> sys.stderr, (
159 05f6d5c0 chazapis
                                "File %s ignored by pattern %s"
160 05f6d5c0 chazapis
                                % (fn, pattern))
161 05f6d5c0 chazapis
                        break
162 05f6d5c0 chazapis
                if bad_name:
163 05f6d5c0 chazapis
                    continue
164 2715ade4 Sofia Papagiannaki
                out.setdefault(package, []).append(prefix + name)
165 05f6d5c0 chazapis
    return out
166 05f6d5c0 chazapis
167 f2d7b5ab Antony Chazapis
setup(
168 2715ade4 Sofia Papagiannaki
    name='snf-pithos-backend',
169 2715ade4 Sofia Papagiannaki
    version=VERSION,
170 2715ade4 Sofia Papagiannaki
    license='BSD',
171 3eea2bc3 Constantinos Venetsanopoulos
    url='http://www.synnefo.org/',
172 2715ade4 Sofia Papagiannaki
    description=SHORT_DESCRIPTION,
173 2715ade4 Sofia Papagiannaki
    classifiers=CLASSIFIERS,
174 2715ade4 Sofia Papagiannaki
175 3eea2bc3 Constantinos Venetsanopoulos
    author='Synnefo development team',
176 3eea2bc3 Constantinos Venetsanopoulos
    author_email='synnefo-devel@googlegroups.com',
177 3eea2bc3 Constantinos Venetsanopoulos
    maintainer='Synnefo development team',
178 3eea2bc3 Constantinos Venetsanopoulos
    maintainer_email='synnefo-devel@googlegroups.com',
179 2715ade4 Sofia Papagiannaki
180 2715ade4 Sofia Papagiannaki
    namespace_packages=['pithos'],
181 2715ade4 Sofia Papagiannaki
    packages=PACKAGES,
182 2715ade4 Sofia Papagiannaki
    package_dir={'': PACKAGES_ROOT},
183 58329afe Kostas Papadimitriou
    package_data=find_package_data("."),
184 2715ade4 Sofia Papagiannaki
    include_package_data=True,
185 2715ade4 Sofia Papagiannaki
    zip_safe=False,
186 8c306eab Kostas Papadimitriou
187 2715ade4 Sofia Papagiannaki
    dependency_links=[
188 3eea2bc3 Constantinos Venetsanopoulos
        'http://www.synnefo.org/packages/pypi'],
189 8c306eab Kostas Papadimitriou
190 2715ade4 Sofia Papagiannaki
    install_requires=INSTALL_REQUIRES,
191 2715ade4 Sofia Papagiannaki
    extras_require=EXTRAS_REQUIRES,
192 2715ade4 Sofia Papagiannaki
    tests_require=TESTS_REQUIRES,
193 8c306eab Kostas Papadimitriou
194 2715ade4 Sofia Papagiannaki
    entry_points={
195 2715ade4 Sofia Papagiannaki
        'console_scripts': [
196 2715ade4 Sofia Papagiannaki
            'pithos-migrate = pithos.backends.migrate:main'
197 2715ade4 Sofia Papagiannaki
        ],
198 9c26045d Kostas Papadimitriou
    },
199 f2d7b5ab Antony Chazapis
)