Statistics
| Branch: | Tag: | Revision:

root / snf-webproject / setup.py @ 600222f6

History | View | Annotate | Download (7 kB)

1 adee02b8 Giorgos Verigakis
# Copyright 2011 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 00b4f1be Faidon Liambotis
40 2ce0636e Kostas Papadimitriou
from distutils.util import convert_path
41 2ce0636e Kostas Papadimitriou
from fnmatch import fnmatchcase
42 2ce0636e Kostas Papadimitriou
from setuptools import setup, find_packages
43 2ce0636e Kostas Papadimitriou
44 2ce0636e Kostas Papadimitriou
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
45 9a32d894 Kostas Papadimitriou
46 9a32d894 Kostas Papadimitriou
try:
47 5d3daee1 Christos Stavrakakis
    # use devflow to update the version file
48 5d3daee1 Christos Stavrakakis
    from devflow.versioning import update_version
49 9a32d894 Kostas Papadimitriou
    update_version('synnefo.versions', 'webproject', HERE)
50 9a32d894 Kostas Papadimitriou
except ImportError:
51 5d3daee1 Christos Stavrakakis
    raise RuntimeError("devflow is a build dependency")
52 9a32d894 Kostas Papadimitriou
53 07d104d8 Kostas Papadimitriou
from synnefo.versions.webproject import __version__
54 2ce0636e Kostas Papadimitriou
55 2ce0636e Kostas Papadimitriou
# Package info
56 07d104d8 Kostas Papadimitriou
VERSION = __version__
57 2ce0636e Kostas Papadimitriou
README = open(os.path.join(HERE, 'README')).read()
58 2ce0636e Kostas Papadimitriou
CHANGES = open(os.path.join(HERE, 'Changelog')).read()
59 2ce0636e Kostas Papadimitriou
SHORT_DESCRIPTION = 'Package short description'
60 2ce0636e Kostas Papadimitriou
61 07d104d8 Kostas Papadimitriou
PACKAGES_ROOT = "."
62 2ce0636e Kostas Papadimitriou
PACKAGES = find_packages(PACKAGES_ROOT)
63 2ce0636e Kostas Papadimitriou
64 2ce0636e Kostas Papadimitriou
# Package meta
65 2ce0636e Kostas Papadimitriou
CLASSIFIERS = []
66 2ce0636e Kostas Papadimitriou
67 2ce0636e Kostas Papadimitriou
# Package requirements
68 2ce0636e Kostas Papadimitriou
INSTALL_REQUIRES = [
69 21dc099b Kostas Papadimitriou
        'Django >=1.2, <1.3',
70 600222f6 Christos Stavrakakis
        'snf-common'
71 2ce0636e Kostas Papadimitriou
]
72 2ce0636e Kostas Papadimitriou
73 2ce0636e Kostas Papadimitriou
EXTRAS_REQUIRES = {
74 2ce0636e Kostas Papadimitriou
}
75 2ce0636e Kostas Papadimitriou
76 2ce0636e Kostas Papadimitriou
TESTS_REQUIRES = [
77 2ce0636e Kostas Papadimitriou
]
78 2ce0636e Kostas Papadimitriou
79 715ca8d0 Kostas Papadimitriou
# Provided as an attribute, so you can append to these instead
80 715ca8d0 Kostas Papadimitriou
# of replicating them:
81 715ca8d0 Kostas Papadimitriou
standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"]
82 715ca8d0 Kostas Papadimitriou
standard_exclude_directories = [
83 715ca8d0 Kostas Papadimitriou
    ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
84 715ca8d0 Kostas Papadimitriou
]
85 715ca8d0 Kostas Papadimitriou
86 715ca8d0 Kostas Papadimitriou
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
87 715ca8d0 Kostas Papadimitriou
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
88 715ca8d0 Kostas Papadimitriou
# Note: you may want to copy this into your setup.py file verbatim, as
89 715ca8d0 Kostas Papadimitriou
# you can't import this from another package, when you don't know if
90 715ca8d0 Kostas Papadimitriou
# that package is installed yet.
91 715ca8d0 Kostas Papadimitriou
def find_package_data(
92 715ca8d0 Kostas Papadimitriou
    where=".",
93 715ca8d0 Kostas Papadimitriou
    package="",
94 715ca8d0 Kostas Papadimitriou
    exclude=standard_exclude,
95 715ca8d0 Kostas Papadimitriou
    exclude_directories=standard_exclude_directories,
96 715ca8d0 Kostas Papadimitriou
    only_in_packages=True,
97 715ca8d0 Kostas Papadimitriou
    show_ignored=False):
98 715ca8d0 Kostas Papadimitriou
    """
99 715ca8d0 Kostas Papadimitriou
    Return a dictionary suitable for use in ``package_data``
100 715ca8d0 Kostas Papadimitriou
    in a distutils ``setup.py`` file.
101 715ca8d0 Kostas Papadimitriou

102 715ca8d0 Kostas Papadimitriou
    The dictionary looks like::
103 715ca8d0 Kostas Papadimitriou

104 715ca8d0 Kostas Papadimitriou
        {"package": [files]}
105 715ca8d0 Kostas Papadimitriou

106 715ca8d0 Kostas Papadimitriou
    Where ``files`` is a list of all the files in that package that
107 715ca8d0 Kostas Papadimitriou
    don"t match anything in ``exclude``.
108 715ca8d0 Kostas Papadimitriou

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

113 715ca8d0 Kostas Papadimitriou
    Directories matching any pattern in ``exclude_directories`` will
114 715ca8d0 Kostas Papadimitriou
    be ignored; by default directories with leading ``.``, ``CVS``,
115 715ca8d0 Kostas Papadimitriou
    and ``_darcs`` will be ignored.
116 715ca8d0 Kostas Papadimitriou

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

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