Statistics
| Branch: | Tag: | Revision:

root / snf-branding / setup.py @ 9cd9bfe7

History | View | Annotate | Download (6.6 kB)

1
# Copyright 2011 GRNET S.A. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
#
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
#
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
#
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.
33
#
34

    
35
import distribute_setup
36
distribute_setup.use_setuptools()
37

    
38
import os
39

    
40
from setuptools import setup, find_packages
41
from fnmatch import fnmatchcase
42
from distutils.util import convert_path
43

    
44
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
45

    
46
from synnefo_branding.version import __version__
47

    
48
# Package info
49
VERSION = __version__
50
README = open(os.path.join(HERE, 'README')).read()
51
CHANGES = open(os.path.join(HERE, 'Changelog')).read()
52
SHORT_DESCRIPTION = 'Synnefo stats grapher'
53

    
54
PACKAGES_ROOT = '.'
55
PACKAGES = find_packages(PACKAGES_ROOT)
56

    
57
# Package meta
58
CLASSIFIERS = []
59

    
60
# Package requirements
61
INSTALL_REQUIRES = [
62
]
63

    
64
# Provided as an attribute, so you can append to these instead
65
# of replicating them:
66
standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"]
67
standard_exclude_directories = [
68
    ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7"
69
]
70

    
71
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
72
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
73
# Note: you may want to copy this into your setup.py file verbatim, as
74
# you can't import this from another package, when you don't know if
75
# that package is installed yet.
76
def find_package_data(
77
    where=".",
78
    package="",
79
    exclude=standard_exclude,
80
    exclude_directories=standard_exclude_directories,
81
    only_in_packages=True,
82
    show_ignored=False):
83
    """
84
    Return a dictionary suitable for use in ``package_data``
85
    in a distutils ``setup.py`` file.
86

87
    The dictionary looks like::
88

89
        {"package": [files]}
90

91
    Where ``files`` is a list of all the files in that package that
92
    don"t match anything in ``exclude``.
93

94
    If ``only_in_packages`` is true, then top-level directories that
95
    are not packages won"t be included (but directories under packages
96
    will).
97

98
    Directories matching any pattern in ``exclude_directories`` will
99
    be ignored; by default directories with leading ``.``, ``CVS``,
100
    and ``_darcs`` will be ignored.
101

102
    If ``show_ignored`` is true, then all the files that aren"t
103
    included in package data are shown on stderr (for debugging
104
    purposes).
105

106
    Note patterns use wildcards, or can be exact paths (including
107
    leading ``./``), and all searching is case-insensitive.
108
    """
109
    out = {}
110
    stack = [(convert_path(where), "", package, only_in_packages)]
111
    while stack:
112
        where, prefix, package, only_in_packages = stack.pop(0)
113
        for name in os.listdir(where):
114
            fn = os.path.join(where, name)
115
            if os.path.isdir(fn):
116
                bad_name = False
117
                for pattern in exclude_directories:
118
                    if (fnmatchcase(name, pattern)
119
                        or fn.lower() == pattern.lower()):
120
                        bad_name = True
121
                        if show_ignored:
122
                            print >> sys.stderr, (
123
                                "Directory %s ignored by pattern %s"
124
                                % (fn, pattern))
125
                        break
126
                if bad_name:
127
                    continue
128
                if (os.path.isfile(os.path.join(fn, "__init__.py"))
129
                    and not prefix):
130
                    if not package:
131
                        new_package = name
132
                    else:
133
                        new_package = package + "." + name
134
                    stack.append((fn, "", new_package, False))
135
                else:
136
                    stack.append((fn, prefix + name + "/", package, only_in_packages))
137
            elif package or not only_in_packages:
138
                # is a file
139
                bad_name = False
140
                for pattern in exclude:
141
                    if (fnmatchcase(name, pattern)
142
                        or fn.lower() == pattern.lower()):
143
                        bad_name = True
144
                        if show_ignored:
145
                            print >> sys.stderr, (
146
                                "File %s ignored by pattern %s"
147
                                % (fn, pattern))
148
                        break
149
                if bad_name:
150
                    continue
151
                out.setdefault(package, []).append(prefix+name)
152
    return out
153
setup(
154
    name='snf-branding',
155
    version=VERSION,
156
    license='BSD',
157
    url='http://www.synnefo.org/',
158
    description=SHORT_DESCRIPTION,
159
    long_description=README + '\n\n' + CHANGES,
160
    classifiers=CLASSIFIERS,
161

    
162
    author='Synnefo development team',
163
    author_email='synnefo-devel@googlegroups.com',
164
    maintainer='Synnefo development team',
165
    maintainer_email='synnefo-devel@googlegroups.com',
166

    
167
    packages=PACKAGES,
168
    package_dir={'': PACKAGES_ROOT},
169
    package_data=find_package_data('.'),
170
    include_package_data=True,
171
    zip_safe=False,
172

    
173
    install_requires=INSTALL_REQUIRES,
174

    
175
    dependency_links=['http://docs.dev.grnet.gr/pypi'],
176
    entry_points={
177
        'synnefo': [ 
178
             'web_apps = synnefo_branding.synnefo_settings:installed_apps',  
179
             'web_context_processors = synnefo_branding.synnefo_settings:context_processors',
180
             'web_static = synnefo_branding.synnefo_settings:static_files',
181
        ]
182
    }
183
)