Statistics
| Branch: | Tag: | Revision:

root / setup.py @ 719d8d08

History | View | Annotate | Download (6.3 kB)

1 52271184 Kostas Papadimitriou
# Copyright 2012 GRNET S.A. All rights reserved.
2 52271184 Kostas Papadimitriou
#
3 52271184 Kostas Papadimitriou
# Redistribution and use in source and binary forms, with or
4 52271184 Kostas Papadimitriou
# without modification, are permitted provided that the following
5 52271184 Kostas Papadimitriou
# conditions are met:
6 52271184 Kostas Papadimitriou
#
7 52271184 Kostas Papadimitriou
#   1. Redistributions of source code must retain the above
8 52271184 Kostas Papadimitriou
#      copyright notice, this list of conditions and the following
9 52271184 Kostas Papadimitriou
#      disclaimer.
10 52271184 Kostas Papadimitriou
#
11 52271184 Kostas Papadimitriou
#   2. Redistributions in binary form must reproduce the above
12 52271184 Kostas Papadimitriou
#      copyright notice, this list of conditions and the following
13 52271184 Kostas Papadimitriou
#      disclaimer in the documentation and/or other materials
14 52271184 Kostas Papadimitriou
#      provided with the distribution.
15 52271184 Kostas Papadimitriou
#
16 52271184 Kostas Papadimitriou
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 52271184 Kostas Papadimitriou
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 52271184 Kostas Papadimitriou
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 52271184 Kostas Papadimitriou
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 52271184 Kostas Papadimitriou
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 52271184 Kostas Papadimitriou
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 52271184 Kostas Papadimitriou
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 52271184 Kostas Papadimitriou
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 52271184 Kostas Papadimitriou
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 52271184 Kostas Papadimitriou
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 52271184 Kostas Papadimitriou
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 52271184 Kostas Papadimitriou
# POSSIBILITY OF SUCH DAMAGE.
28 52271184 Kostas Papadimitriou
#
29 52271184 Kostas Papadimitriou
# The views and conclusions contained in the software and
30 52271184 Kostas Papadimitriou
# documentation are those of the authors and should not be
31 52271184 Kostas Papadimitriou
# interpreted as representing official policies, either expressed
32 52271184 Kostas Papadimitriou
# or implied, of GRNET S.A.
33 52271184 Kostas Papadimitriou
34 52271184 Kostas Papadimitriou
35 872ca586 Kostas Papadimitriou
import os
36 872ca586 Kostas Papadimitriou
import sys
37 872ca586 Kostas Papadimitriou
38 872ca586 Kostas Papadimitriou
from fnmatch import fnmatchcase
39 872ca586 Kostas Papadimitriou
from distutils.util import convert_path
40 c1468bcc Kostas Papadimitriou
from setuptools import setup, find_packages
41 c1468bcc Kostas Papadimitriou
42 1cf03785 Kostas Papadimitriou
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
43 1cf03785 Kostas Papadimitriou
try:
44 1cf03785 Kostas Papadimitriou
    # try to update the version file
45 1cf03785 Kostas Papadimitriou
    from synnefo.util import version
46 1cf03785 Kostas Papadimitriou
    version.update_version('cloudcms', 'version', HERE)
47 1cf03785 Kostas Papadimitriou
except ImportError:
48 1cf03785 Kostas Papadimitriou
    pass
49 1cf03785 Kostas Papadimitriou
50 1cf03785 Kostas Papadimitriou
from cloudcms.version import __version__
51 1cf03785 Kostas Papadimitriou
52 1cf03785 Kostas Papadimitriou
# Package info
53 1cf03785 Kostas Papadimitriou
VERSION = __version__
54 1cf03785 Kostas Papadimitriou
55 1cf03785 Kostas Papadimitriou
56 872ca586 Kostas Papadimitriou
INSTALL_REQUIRES = [
57 bed4fff9 Kostas Papadimitriou
    'snf-common>=0.9.0',
58 d63539ef Kostas Papadimitriou
    'Django >=1.2.3, <1.3',
59 33818d21 Kostas Papadimitriou
    'South>=0.7',
60 f91cc59d Kostas Papadimitriou
    'feincms >=1.4.2, < 1.5',
61 f91cc59d Kostas Papadimitriou
    'django-pagination >=1.0.5'
62 872ca586 Kostas Papadimitriou
]
63 872ca586 Kostas Papadimitriou
CLASSIFIERS = []
64 872ca586 Kostas Papadimitriou
65 d63539ef Kostas Papadimitriou
66 d63539ef Kostas Papadimitriou
# Provided as an attribute, so you can append to these instead
67 d63539ef Kostas Papadimitriou
# of replicating them:
68 d63539ef Kostas Papadimitriou
standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
69 d63539ef Kostas Papadimitriou
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
70 d63539ef Kostas Papadimitriou
                                './dist', 'EGG-INFO', '*.egg-info')
71 d63539ef Kostas Papadimitriou
72 d63539ef Kostas Papadimitriou
def find_package_data(
73 d63539ef Kostas Papadimitriou
    where='.', package='',
74 d63539ef Kostas Papadimitriou
    exclude=standard_exclude,
75 d63539ef Kostas Papadimitriou
    exclude_directories=standard_exclude_directories,
76 d63539ef Kostas Papadimitriou
    only_in_packages=True,
77 d63539ef Kostas Papadimitriou
    show_ignored=False):
78 d63539ef Kostas Papadimitriou
    """
79 d63539ef Kostas Papadimitriou
    Return a dictionary suitable for use in ``package_data``
80 d63539ef Kostas Papadimitriou
    in a distutils ``setup.py`` file.
81 d63539ef Kostas Papadimitriou

82 d63539ef Kostas Papadimitriou
    The dictionary looks like::
83 d63539ef Kostas Papadimitriou

84 d63539ef Kostas Papadimitriou
        {'package': [files]}
85 d63539ef Kostas Papadimitriou

86 d63539ef Kostas Papadimitriou
    Where ``files`` is a list of all the files in that package that
87 d63539ef Kostas Papadimitriou
    don't match anything in ``exclude``.
88 d63539ef Kostas Papadimitriou

89 d63539ef Kostas Papadimitriou
    If ``only_in_packages`` is true, then top-level directories that
90 d63539ef Kostas Papadimitriou
    are not packages won't be included (but directories under packages
91 d63539ef Kostas Papadimitriou
    will).
92 d63539ef Kostas Papadimitriou

93 d63539ef Kostas Papadimitriou
    Directories matching any pattern in ``exclude_directories`` will
94 d63539ef Kostas Papadimitriou
    be ignored; by default directories with leading ``.``, ``CVS``,
95 d63539ef Kostas Papadimitriou
    and ``_darcs`` will be ignored.
96 d63539ef Kostas Papadimitriou

97 d63539ef Kostas Papadimitriou
    If ``show_ignored`` is true, then all the files that aren't
98 d63539ef Kostas Papadimitriou
    included in package data are shown on stderr (for debugging
99 d63539ef Kostas Papadimitriou
    purposes).
100 d63539ef Kostas Papadimitriou

101 d63539ef Kostas Papadimitriou
    Note patterns use wildcards, or can be exact paths (including
102 d63539ef Kostas Papadimitriou
    leading ``./``), and all searching is case-insensitive.
103 d63539ef Kostas Papadimitriou
    """
104 d63539ef Kostas Papadimitriou
105 d63539ef Kostas Papadimitriou
    out = {}
106 d63539ef Kostas Papadimitriou
    stack = [(convert_path(where), '', package, only_in_packages)]
107 d63539ef Kostas Papadimitriou
    while stack:
108 d63539ef Kostas Papadimitriou
        where, prefix, package, only_in_packages = stack.pop(0)
109 d63539ef Kostas Papadimitriou
        for name in os.listdir(where):
110 d63539ef Kostas Papadimitriou
            fn = os.path.join(where, name)
111 d63539ef Kostas Papadimitriou
            if os.path.isdir(fn):
112 d63539ef Kostas Papadimitriou
                bad_name = False
113 d63539ef Kostas Papadimitriou
                for pattern in exclude_directories:
114 d63539ef Kostas Papadimitriou
                    if (fnmatchcase(name, pattern)
115 d63539ef Kostas Papadimitriou
                        or fn.lower() == pattern.lower()):
116 d63539ef Kostas Papadimitriou
                        bad_name = True
117 d63539ef Kostas Papadimitriou
                        if show_ignored:
118 d63539ef Kostas Papadimitriou
                            print >> sys.stderr, (
119 d63539ef Kostas Papadimitriou
                                "Directory %s ignored by pattern %s"
120 d63539ef Kostas Papadimitriou
                                % (fn, pattern))
121 d63539ef Kostas Papadimitriou
                        break
122 d63539ef Kostas Papadimitriou
                if bad_name:
123 d63539ef Kostas Papadimitriou
                    continue
124 d63539ef Kostas Papadimitriou
                if (os.path.isfile(os.path.join(fn, '__init__.py'))
125 d63539ef Kostas Papadimitriou
                    and not prefix):
126 d63539ef Kostas Papadimitriou
                    if not package:
127 d63539ef Kostas Papadimitriou
                        new_package = name
128 d63539ef Kostas Papadimitriou
                    else:
129 d63539ef Kostas Papadimitriou
                        new_package = package + '.' + name
130 d63539ef Kostas Papadimitriou
                    stack.append((fn, '', new_package, False))
131 d63539ef Kostas Papadimitriou
                else:
132 d63539ef Kostas Papadimitriou
                    stack.append((fn, prefix + name + '/', package, only_in_packages))
133 d63539ef Kostas Papadimitriou
            elif package or not only_in_packages:
134 d63539ef Kostas Papadimitriou
                # is a file
135 d63539ef Kostas Papadimitriou
                bad_name = False
136 d63539ef Kostas Papadimitriou
                for pattern in exclude:
137 d63539ef Kostas Papadimitriou
                    if (fnmatchcase(name, pattern)
138 d63539ef Kostas Papadimitriou
                        or fn.lower() == pattern.lower()):
139 d63539ef Kostas Papadimitriou
                        bad_name = True
140 d63539ef Kostas Papadimitriou
                        if show_ignored:
141 d63539ef Kostas Papadimitriou
                            print >> sys.stderr, (
142 d63539ef Kostas Papadimitriou
                                "File %s ignored by pattern %s"
143 d63539ef Kostas Papadimitriou
                                % (fn, pattern))
144 d63539ef Kostas Papadimitriou
                        break
145 d63539ef Kostas Papadimitriou
                if bad_name:
146 d63539ef Kostas Papadimitriou
                    continue
147 d63539ef Kostas Papadimitriou
                out.setdefault(package, []).append(prefix+name)
148 d63539ef Kostas Papadimitriou
    return out
149 d63539ef Kostas Papadimitriou
150 c1468bcc Kostas Papadimitriou
setup(
151 872ca586 Kostas Papadimitriou
    name = 'snf-cloudcms',
152 872ca586 Kostas Papadimitriou
    version = VERSION,
153 872ca586 Kostas Papadimitriou
    license = 'BSD',
154 872ca586 Kostas Papadimitriou
    url = 'http://code.grnet.gr/',
155 872ca586 Kostas Papadimitriou
    classifiers = CLASSIFIERS,
156 872ca586 Kostas Papadimitriou
157 872ca586 Kostas Papadimitriou
    author = 'Package author',
158 872ca586 Kostas Papadimitriou
    author_email = 'author@grnet.gr',
159 872ca586 Kostas Papadimitriou
    maintainer = 'Package maintainer',
160 872ca586 Kostas Papadimitriou
    maintainer_email = 'maintainer@grnet.gr',
161 872ca586 Kostas Papadimitriou
162 872ca586 Kostas Papadimitriou
    packages = find_packages('.'),
163 872ca586 Kostas Papadimitriou
    package_dir= {'': '.'},
164 872ca586 Kostas Papadimitriou
    include_package_data = True,
165 d63539ef Kostas Papadimitriou
    package_data=find_package_data('.'),
166 872ca586 Kostas Papadimitriou
    zip_safe = False,
167 872ca586 Kostas Papadimitriou
168 872ca586 Kostas Papadimitriou
    install_requires = INSTALL_REQUIRES,
169 872ca586 Kostas Papadimitriou
170 872ca586 Kostas Papadimitriou
    dependency_links = ['http://docs.dev.grnet.gr/pypi'],
171 c1468bcc Kostas Papadimitriou
172 c1468bcc Kostas Papadimitriou
    entry_points = {
173 c1468bcc Kostas Papadimitriou
     'synnefo': [
174 872ca586 Kostas Papadimitriou
         'default_settings = cloudcms.synnefo_settings',
175 ae70c3c6 Kostas Papadimitriou
         'web_apps = cloudcms.synnefo_settings:cloudcms_apps',
176 ae70c3c6 Kostas Papadimitriou
         'web_middleware = cloudcms.synnefo_settings:cloudcms_middlewares',
177 ae70c3c6 Kostas Papadimitriou
         'web_context_processors = cloudcms.synnefo_settings:cloudcms_context_processors',
178 c1468bcc Kostas Papadimitriou
         'urls = cloudcms.urls:urlpatterns',
179 ae70c3c6 Kostas Papadimitriou
         'web_static = cloudcms.synnefo_settings:cloudcms_staticfiles'
180 c1468bcc Kostas Papadimitriou
         ]
181 c1468bcc Kostas Papadimitriou
    },
182 c1468bcc Kostas Papadimitriou
183 c1468bcc Kostas Papadimitriou
)