Statistics
| Branch: | Tag: | Revision:

root / snf-pithos-backend / setup.py @ 5ec446aa

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

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

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

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

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

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

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

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