root / snf-branding / setup.py @ 435bb7fb
History | View | Annotate | Download (6.5 kB)
1 | 9d889386 | Olga Brani | # Copyright 2011 GRNET S.A. All rights reserved.
|
---|---|---|---|
2 | 9d889386 | Olga Brani | #
|
3 | 9d889386 | Olga Brani | # Redistribution and use in source and binary forms, with or
|
4 | 9d889386 | Olga Brani | # without modification, are permitted provided that the following
|
5 | 9d889386 | Olga Brani | # conditions are met:
|
6 | 9d889386 | Olga Brani | #
|
7 | 9d889386 | Olga Brani | # 1. Redistributions of source code must retain the above
|
8 | 9d889386 | Olga Brani | # copyright notice, this list of conditions and the following
|
9 | 9d889386 | Olga Brani | # disclaimer.
|
10 | 9d889386 | Olga Brani | #
|
11 | 9d889386 | Olga Brani | # 2. Redistributions in binary form must reproduce the above
|
12 | 9d889386 | Olga Brani | # copyright notice, this list of conditions and the following
|
13 | 9d889386 | Olga Brani | # disclaimer in the documentation and/or other materials
|
14 | 9d889386 | Olga Brani | # provided with the distribution.
|
15 | 9d889386 | Olga Brani | #
|
16 | 9d889386 | Olga Brani | # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
17 | 9d889386 | Olga Brani | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 | 9d889386 | Olga Brani | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19 | 9d889386 | Olga Brani | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
20 | 9d889386 | Olga Brani | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21 | 9d889386 | Olga Brani | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 | 9d889386 | Olga Brani | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
23 | 9d889386 | Olga Brani | # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
24 | 9d889386 | Olga Brani | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
25 | 9d889386 | Olga Brani | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
26 | 9d889386 | Olga Brani | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 | 9d889386 | Olga Brani | # POSSIBILITY OF SUCH DAMAGE.
|
28 | 9d889386 | Olga Brani | #
|
29 | 9d889386 | Olga Brani | # The views and conclusions contained in the software and
|
30 | 9d889386 | Olga Brani | # documentation are those of the authors and should not be
|
31 | 9d889386 | Olga Brani | # interpreted as representing official policies, either expressed
|
32 | 9d889386 | Olga Brani | # or implied, of GRNET S.A.
|
33 | 9d889386 | Olga Brani | #
|
34 | 9d889386 | Olga Brani | |
35 | 9d889386 | Olga Brani | import distribute_setup |
36 | 9d889386 | Olga Brani | distribute_setup.use_setuptools() |
37 | 9d889386 | Olga Brani | |
38 | 9d889386 | Olga Brani | import os |
39 | 9d889386 | Olga Brani | |
40 | 9d889386 | Olga Brani | from setuptools import setup, find_packages |
41 | 00326543 | Kostas Papadimitriou | from fnmatch import fnmatchcase |
42 | 00326543 | Kostas Papadimitriou | from distutils.util import convert_path |
43 | 9d889386 | Olga Brani | |
44 | 9d889386 | Olga Brani | HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__))) |
45 | 9d889386 | Olga Brani | |
46 | 9d889386 | Olga Brani | from synnefo_branding.version import __version__ |
47 | 9d889386 | Olga Brani | |
48 | 9d889386 | Olga Brani | # Package info
|
49 | 9d889386 | Olga Brani | VERSION = __version__ |
50 | 9d889386 | Olga Brani | SHORT_DESCRIPTION = 'Synnefo stats grapher'
|
51 | 9d889386 | Olga Brani | |
52 | 9d889386 | Olga Brani | PACKAGES_ROOT = '.'
|
53 | 9d889386 | Olga Brani | PACKAGES = find_packages(PACKAGES_ROOT) |
54 | 9d889386 | Olga Brani | |
55 | 9d889386 | Olga Brani | # Package meta
|
56 | 9d889386 | Olga Brani | CLASSIFIERS = [] |
57 | 9d889386 | Olga Brani | |
58 | 9d889386 | Olga Brani | # Package requirements
|
59 | 9d889386 | Olga Brani | INSTALL_REQUIRES = [ |
60 | 9d889386 | Olga Brani | ] |
61 | 9d889386 | Olga Brani | |
62 | 00326543 | Kostas Papadimitriou | # Provided as an attribute, so you can append to these instead
|
63 | 00326543 | Kostas Papadimitriou | # of replicating them:
|
64 | 00326543 | Kostas Papadimitriou | standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"] |
65 | 00326543 | Kostas Papadimitriou | standard_exclude_directories = [ |
66 | 00326543 | Kostas Papadimitriou | ".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7" |
67 | 00326543 | Kostas Papadimitriou | ] |
68 | 00326543 | Kostas Papadimitriou | |
69 | 00326543 | Kostas Papadimitriou | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
|
70 | 00326543 | Kostas Papadimitriou | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
71 | 00326543 | Kostas Papadimitriou | # Note: you may want to copy this into your setup.py file verbatim, as
|
72 | 00326543 | Kostas Papadimitriou | # you can't import this from another package, when you don't know if
|
73 | 00326543 | Kostas Papadimitriou | # that package is installed yet.
|
74 | 00326543 | Kostas Papadimitriou | def find_package_data( |
75 | 00326543 | Kostas Papadimitriou | where=".",
|
76 | 00326543 | Kostas Papadimitriou | package="",
|
77 | 00326543 | Kostas Papadimitriou | exclude=standard_exclude, |
78 | 00326543 | Kostas Papadimitriou | exclude_directories=standard_exclude_directories, |
79 | 00326543 | Kostas Papadimitriou | only_in_packages=True,
|
80 | 00326543 | Kostas Papadimitriou | show_ignored=False):
|
81 | 00326543 | Kostas Papadimitriou | """
|
82 | 00326543 | Kostas Papadimitriou | Return a dictionary suitable for use in ``package_data``
|
83 | 00326543 | Kostas Papadimitriou | in a distutils ``setup.py`` file.
|
84 | 00326543 | Kostas Papadimitriou |
|
85 | 00326543 | Kostas Papadimitriou | The dictionary looks like::
|
86 | 00326543 | Kostas Papadimitriou |
|
87 | 00326543 | Kostas Papadimitriou | {"package": [files]}
|
88 | 00326543 | Kostas Papadimitriou |
|
89 | 00326543 | Kostas Papadimitriou | Where ``files`` is a list of all the files in that package that
|
90 | 00326543 | Kostas Papadimitriou | don"t match anything in ``exclude``.
|
91 | 00326543 | Kostas Papadimitriou |
|
92 | 00326543 | Kostas Papadimitriou | If ``only_in_packages`` is true, then top-level directories that
|
93 | 00326543 | Kostas Papadimitriou | are not packages won"t be included (but directories under packages
|
94 | 00326543 | Kostas Papadimitriou | will).
|
95 | 00326543 | Kostas Papadimitriou |
|
96 | 00326543 | Kostas Papadimitriou | Directories matching any pattern in ``exclude_directories`` will
|
97 | 00326543 | Kostas Papadimitriou | be ignored; by default directories with leading ``.``, ``CVS``,
|
98 | 00326543 | Kostas Papadimitriou | and ``_darcs`` will be ignored.
|
99 | 00326543 | Kostas Papadimitriou |
|
100 | 00326543 | Kostas Papadimitriou | If ``show_ignored`` is true, then all the files that aren"t
|
101 | 00326543 | Kostas Papadimitriou | included in package data are shown on stderr (for debugging
|
102 | 00326543 | Kostas Papadimitriou | purposes).
|
103 | 00326543 | Kostas Papadimitriou |
|
104 | 00326543 | Kostas Papadimitriou | Note patterns use wildcards, or can be exact paths (including
|
105 | 00326543 | Kostas Papadimitriou | leading ``./``), and all searching is case-insensitive.
|
106 | 00326543 | Kostas Papadimitriou | """
|
107 | 00326543 | Kostas Papadimitriou | out = {} |
108 | 00326543 | Kostas Papadimitriou | stack = [(convert_path(where), "", package, only_in_packages)]
|
109 | 00326543 | Kostas Papadimitriou | while stack:
|
110 | 00326543 | Kostas Papadimitriou | where, prefix, package, only_in_packages = stack.pop(0)
|
111 | 00326543 | Kostas Papadimitriou | for name in os.listdir(where): |
112 | 00326543 | Kostas Papadimitriou | fn = os.path.join(where, name) |
113 | 00326543 | Kostas Papadimitriou | if os.path.isdir(fn):
|
114 | 00326543 | Kostas Papadimitriou | bad_name = False
|
115 | 00326543 | Kostas Papadimitriou | for pattern in exclude_directories: |
116 | 00326543 | Kostas Papadimitriou | if (fnmatchcase(name, pattern)
|
117 | 00326543 | Kostas Papadimitriou | or fn.lower() == pattern.lower()):
|
118 | 00326543 | Kostas Papadimitriou | bad_name = True
|
119 | 00326543 | Kostas Papadimitriou | if show_ignored:
|
120 | 00326543 | Kostas Papadimitriou | print >> sys.stderr, (
|
121 | 00326543 | Kostas Papadimitriou | "Directory %s ignored by pattern %s"
|
122 | 00326543 | Kostas Papadimitriou | % (fn, pattern)) |
123 | 00326543 | Kostas Papadimitriou | break
|
124 | 00326543 | Kostas Papadimitriou | if bad_name:
|
125 | 00326543 | Kostas Papadimitriou | continue
|
126 | 00326543 | Kostas Papadimitriou | if (os.path.isfile(os.path.join(fn, "__init__.py")) |
127 | 00326543 | Kostas Papadimitriou | and not prefix): |
128 | 00326543 | Kostas Papadimitriou | if not package: |
129 | 00326543 | Kostas Papadimitriou | new_package = name |
130 | 00326543 | Kostas Papadimitriou | else:
|
131 | 00326543 | Kostas Papadimitriou | new_package = package + "." + name
|
132 | 00326543 | Kostas Papadimitriou | stack.append((fn, "", new_package, False)) |
133 | 00326543 | Kostas Papadimitriou | else:
|
134 | 00326543 | Kostas Papadimitriou | stack.append((fn, prefix + name + "/", package, only_in_packages))
|
135 | 00326543 | Kostas Papadimitriou | elif package or not only_in_packages: |
136 | 00326543 | Kostas Papadimitriou | # is a file
|
137 | 00326543 | Kostas Papadimitriou | bad_name = False
|
138 | 00326543 | Kostas Papadimitriou | for pattern in exclude: |
139 | 00326543 | Kostas Papadimitriou | if (fnmatchcase(name, pattern)
|
140 | 00326543 | Kostas Papadimitriou | or fn.lower() == pattern.lower()):
|
141 | 00326543 | Kostas Papadimitriou | bad_name = True
|
142 | 00326543 | Kostas Papadimitriou | if show_ignored:
|
143 | 00326543 | Kostas Papadimitriou | print >> sys.stderr, (
|
144 | 00326543 | Kostas Papadimitriou | "File %s ignored by pattern %s"
|
145 | 00326543 | Kostas Papadimitriou | % (fn, pattern)) |
146 | 00326543 | Kostas Papadimitriou | break
|
147 | 00326543 | Kostas Papadimitriou | if bad_name:
|
148 | 00326543 | Kostas Papadimitriou | continue
|
149 | 00326543 | Kostas Papadimitriou | out.setdefault(package, []).append(prefix+name) |
150 | 00326543 | Kostas Papadimitriou | return out
|
151 | 9d889386 | Olga Brani | setup( |
152 | 4b01493d | Georgios D. Tsoukalas | name='snf-branding',
|
153 | 9d889386 | Olga Brani | version=VERSION, |
154 | 9d889386 | Olga Brani | license='BSD',
|
155 | 9d889386 | Olga Brani | url='http://www.synnefo.org/',
|
156 | 9d889386 | Olga Brani | description=SHORT_DESCRIPTION, |
157 | 9d889386 | Olga Brani | classifiers=CLASSIFIERS, |
158 | 9d889386 | Olga Brani | |
159 | 9d889386 | Olga Brani | author='Synnefo development team',
|
160 | 9d889386 | Olga Brani | author_email='synnefo-devel@googlegroups.com',
|
161 | 9d889386 | Olga Brani | maintainer='Synnefo development team',
|
162 | 9d889386 | Olga Brani | maintainer_email='synnefo-devel@googlegroups.com',
|
163 | 9d889386 | Olga Brani | |
164 | 9d889386 | Olga Brani | packages=PACKAGES, |
165 | 9d889386 | Olga Brani | package_dir={'': PACKAGES_ROOT},
|
166 | 00326543 | Kostas Papadimitriou | package_data=find_package_data('.'),
|
167 | 9d889386 | Olga Brani | include_package_data=True,
|
168 | 9d889386 | Olga Brani | zip_safe=False,
|
169 | 9d889386 | Olga Brani | |
170 | 9d889386 | Olga Brani | install_requires=INSTALL_REQUIRES, |
171 | 9d889386 | Olga Brani | |
172 | 9d889386 | Olga Brani | dependency_links=['http://docs.dev.grnet.gr/pypi'],
|
173 | 9d889386 | Olga Brani | entry_points={ |
174 | 9d889386 | Olga Brani | 'synnefo': [
|
175 | 9d889386 | Olga Brani | 'web_apps = synnefo_branding.synnefo_settings:installed_apps',
|
176 | 9d889386 | Olga Brani | 'web_context_processors = synnefo_branding.synnefo_settings:context_processors',
|
177 | 9d889386 | Olga Brani | 'web_static = synnefo_branding.synnefo_settings:static_files',
|
178 | 9d889386 | Olga Brani | ] |
179 | 9d889386 | Olga Brani | } |
180 | 9d889386 | Olga Brani | ) |