Statistics
| Branch: | Tag: | Revision:

root / snf-webproject / setup.py @ 10d9cd27

History | View | Annotate | Download (6.7 kB)

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

96 715ca8d0 Kostas Papadimitriou
    The dictionary looks like::
97 715ca8d0 Kostas Papadimitriou

98 715ca8d0 Kostas Papadimitriou
        {"package": [files]}
99 715ca8d0 Kostas Papadimitriou

100 715ca8d0 Kostas Papadimitriou
    Where ``files`` is a list of all the files in that package that
101 715ca8d0 Kostas Papadimitriou
    don"t match anything in ``exclude``.
102 715ca8d0 Kostas Papadimitriou

103 715ca8d0 Kostas Papadimitriou
    If ``only_in_packages`` is true, then top-level directories that
104 715ca8d0 Kostas Papadimitriou
    are not packages won"t be included (but directories under packages
105 715ca8d0 Kostas Papadimitriou
    will).
106 715ca8d0 Kostas Papadimitriou

107 715ca8d0 Kostas Papadimitriou
    Directories matching any pattern in ``exclude_directories`` will
108 715ca8d0 Kostas Papadimitriou
    be ignored; by default directories with leading ``.``, ``CVS``,
109 715ca8d0 Kostas Papadimitriou
    and ``_darcs`` will be ignored.
110 715ca8d0 Kostas Papadimitriou

111 715ca8d0 Kostas Papadimitriou
    If ``show_ignored`` is true, then all the files that aren"t
112 715ca8d0 Kostas Papadimitriou
    included in package data are shown on stderr (for debugging
113 715ca8d0 Kostas Papadimitriou
    purposes).
114 715ca8d0 Kostas Papadimitriou

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