root / snf-app / setup.py @ df285bb3
History | View | Annotate | Download (5.6 kB)
1 |
import distribute_setup |
---|---|
2 |
distribute_setup.use_setuptools() |
3 |
|
4 |
import os |
5 |
|
6 |
from distutils.util import convert_path |
7 |
from fnmatch import fnmatchcase |
8 |
from setuptools import setup, find_packages |
9 |
from synnefo import get_version |
10 |
|
11 |
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__))) |
12 |
|
13 |
# Package info
|
14 |
VERSION = get_version().replace(" ","") |
15 |
README = open(os.path.join(HERE, 'README')).read() |
16 |
CHANGES = open(os.path.join(HERE, 'Changelog')).read() |
17 |
SHORT_DESCRIPTION = 'Package short description'
|
18 |
|
19 |
PACKAGES_ROOT = '.'
|
20 |
PACKAGES = find_packages(PACKAGES_ROOT, exclude=['okeanos_site'])
|
21 |
|
22 |
# Package meta
|
23 |
CLASSIFIERS = [] |
24 |
|
25 |
# Package requirements
|
26 |
INSTALL_REQUIRES = [ |
27 |
'Django==1.2.4',
|
28 |
'simplejson==2.1.3',
|
29 |
'pycurl==7.19.0',
|
30 |
'python-dateutil==1.4.1',
|
31 |
'IPy==0.75',
|
32 |
'south==0.7.1',
|
33 |
'pycrypto==2.1.0',
|
34 |
'amqplib==0.6.1',
|
35 |
'python-daemon==1.5.5'
|
36 |
] |
37 |
|
38 |
EXTRAS_REQUIRES = { |
39 |
'DISPATCHER': ['amqplib==0.6.1', 'python-daemon==1.5.5',], |
40 |
'INVITATIONS': ['pycrypto==2.1.0'], |
41 |
'SSH_KEYS': ['pycrypto==2.1.0'], |
42 |
'BURNIN': ['unittest2==0.5.1', 'paramiko==1.7.6', 'python-prctl==1.3.0'] |
43 |
} |
44 |
|
45 |
TESTS_REQUIRES = [ |
46 |
] |
47 |
|
48 |
|
49 |
# Provided as an attribute, so you can append to these instead
|
50 |
# of replicating them:
|
51 |
standard_exclude = ["*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak"] |
52 |
standard_exclude_directories = [ |
53 |
".*", "CVS", "_darcs", "./build", "./dist", "EGG-INFO", "*.egg-info", "snf-0.7" |
54 |
] |
55 |
|
56 |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
|
57 |
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
58 |
# Note: you may want to copy this into your setup.py file verbatim, as
|
59 |
# you can't import this from another package, when you don't know if
|
60 |
# that package is installed yet.
|
61 |
def find_package_data( |
62 |
where=".",
|
63 |
package="",
|
64 |
exclude=standard_exclude, |
65 |
exclude_directories=standard_exclude_directories, |
66 |
only_in_packages=True,
|
67 |
show_ignored=False):
|
68 |
"""
|
69 |
Return a dictionary suitable for use in ``package_data``
|
70 |
in a distutils ``setup.py`` file.
|
71 |
|
72 |
The dictionary looks like::
|
73 |
|
74 |
{"package": [files]}
|
75 |
|
76 |
Where ``files`` is a list of all the files in that package that
|
77 |
don"t match anything in ``exclude``.
|
78 |
|
79 |
If ``only_in_packages`` is true, then top-level directories that
|
80 |
are not packages won"t be included (but directories under packages
|
81 |
will).
|
82 |
|
83 |
Directories matching any pattern in ``exclude_directories`` will
|
84 |
be ignored; by default directories with leading ``.``, ``CVS``,
|
85 |
and ``_darcs`` will be ignored.
|
86 |
|
87 |
If ``show_ignored`` is true, then all the files that aren"t
|
88 |
included in package data are shown on stderr (for debugging
|
89 |
purposes).
|
90 |
|
91 |
Note patterns use wildcards, or can be exact paths (including
|
92 |
leading ``./``), and all searching is case-insensitive.
|
93 |
"""
|
94 |
out = {} |
95 |
stack = [(convert_path(where), "", package, only_in_packages)]
|
96 |
while stack:
|
97 |
where, prefix, package, only_in_packages = stack.pop(0)
|
98 |
for name in os.listdir(where): |
99 |
fn = os.path.join(where, name) |
100 |
if os.path.isdir(fn):
|
101 |
bad_name = False
|
102 |
for pattern in exclude_directories: |
103 |
if (fnmatchcase(name, pattern)
|
104 |
or fn.lower() == pattern.lower()):
|
105 |
bad_name = True
|
106 |
if show_ignored:
|
107 |
print >> sys.stderr, (
|
108 |
"Directory %s ignored by pattern %s"
|
109 |
% (fn, pattern)) |
110 |
break
|
111 |
if bad_name:
|
112 |
continue
|
113 |
if (os.path.isfile(os.path.join(fn, "__init__.py")) |
114 |
and not prefix): |
115 |
if not package: |
116 |
new_package = name |
117 |
else:
|
118 |
new_package = package + "." + name
|
119 |
stack.append((fn, "", new_package, False)) |
120 |
else:
|
121 |
stack.append((fn, prefix + name + "/", package, only_in_packages))
|
122 |
elif package or not only_in_packages: |
123 |
# is a file
|
124 |
bad_name = False
|
125 |
for pattern in exclude: |
126 |
if (fnmatchcase(name, pattern)
|
127 |
or fn.lower() == pattern.lower()):
|
128 |
bad_name = True
|
129 |
if show_ignored:
|
130 |
print >> sys.stderr, (
|
131 |
"File %s ignored by pattern %s"
|
132 |
% (fn, pattern)) |
133 |
break
|
134 |
if bad_name:
|
135 |
continue
|
136 |
out.setdefault(package, []).append(prefix+name) |
137 |
return out
|
138 |
|
139 |
setup( |
140 |
name = 'synnefo',
|
141 |
version = VERSION, |
142 |
license = 'BSD',
|
143 |
url = 'http://code.grnet.gr/',
|
144 |
description = SHORT_DESCRIPTION, |
145 |
long_description=README + '\n\n' + CHANGES,
|
146 |
classifiers = CLASSIFIERS, |
147 |
|
148 |
author = 'Package author',
|
149 |
author_email = 'author@grnet.gr',
|
150 |
maintainer = 'Package maintainer',
|
151 |
maintainer_email = 'maintainer@grnet.gr',
|
152 |
|
153 |
packages = PACKAGES, |
154 |
package_dir= {'': PACKAGES_ROOT},
|
155 |
include_package_data = True,
|
156 |
package_data = find_package_data('.'),
|
157 |
zip_safe = False,
|
158 |
|
159 |
install_requires = INSTALL_REQUIRES, |
160 |
extras_require = EXTRAS_REQUIRES, |
161 |
tests_require = TESTS_REQUIRES, |
162 |
|
163 |
entry_points = { |
164 |
'console_scripts': [
|
165 |
'snf-manage = synnefo.manage:main',
|
166 |
'snf-dispatcher = synnefo.logic.dispatcher:scriptmain',
|
167 |
'snf-burnin = synnefo.tools.burnin:main',
|
168 |
'snf-admin = synnefo.tools.admin:main',
|
169 |
'snf-cloud = synnefo.tools.cloud:main',
|
170 |
], |
171 |
}, |
172 |
) |
173 |
|