Revision d63539ef setup.py
b/setup.py | ||
---|---|---|
6 | 6 |
from setuptools import setup, find_packages |
7 | 7 |
|
8 | 8 |
INSTALL_REQUIRES = [ |
9 |
'Django==1.2.3, <1.3',
|
|
9 |
'Django >=1.2.3, <1.3',
|
|
10 | 10 |
'South==0.7', |
11 |
'snf-webproject' |
|
11 |
'snf-webproject', |
|
12 |
'feincms >=1.4.2, < 1.5' |
|
12 | 13 |
] |
13 | 14 |
CLASSIFIERS = [] |
14 | 15 |
|
16 |
|
|
17 |
# Provided as an attribute, so you can append to these instead |
|
18 |
# of replicating them: |
|
19 |
standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak') |
|
20 |
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build', |
|
21 |
'./dist', 'EGG-INFO', '*.egg-info') |
|
22 |
|
|
23 |
def find_package_data( |
|
24 |
where='.', package='', |
|
25 |
exclude=standard_exclude, |
|
26 |
exclude_directories=standard_exclude_directories, |
|
27 |
only_in_packages=True, |
|
28 |
show_ignored=False): |
|
29 |
""" |
|
30 |
Return a dictionary suitable for use in ``package_data`` |
|
31 |
in a distutils ``setup.py`` file. |
|
32 |
|
|
33 |
The dictionary looks like:: |
|
34 |
|
|
35 |
{'package': [files]} |
|
36 |
|
|
37 |
Where ``files`` is a list of all the files in that package that |
|
38 |
don't match anything in ``exclude``. |
|
39 |
|
|
40 |
If ``only_in_packages`` is true, then top-level directories that |
|
41 |
are not packages won't be included (but directories under packages |
|
42 |
will). |
|
43 |
|
|
44 |
Directories matching any pattern in ``exclude_directories`` will |
|
45 |
be ignored; by default directories with leading ``.``, ``CVS``, |
|
46 |
and ``_darcs`` will be ignored. |
|
47 |
|
|
48 |
If ``show_ignored`` is true, then all the files that aren't |
|
49 |
included in package data are shown on stderr (for debugging |
|
50 |
purposes). |
|
51 |
|
|
52 |
Note patterns use wildcards, or can be exact paths (including |
|
53 |
leading ``./``), and all searching is case-insensitive. |
|
54 |
""" |
|
55 |
|
|
56 |
out = {} |
|
57 |
stack = [(convert_path(where), '', package, only_in_packages)] |
|
58 |
while stack: |
|
59 |
where, prefix, package, only_in_packages = stack.pop(0) |
|
60 |
for name in os.listdir(where): |
|
61 |
fn = os.path.join(where, name) |
|
62 |
if os.path.isdir(fn): |
|
63 |
bad_name = False |
|
64 |
for pattern in exclude_directories: |
|
65 |
if (fnmatchcase(name, pattern) |
|
66 |
or fn.lower() == pattern.lower()): |
|
67 |
bad_name = True |
|
68 |
if show_ignored: |
|
69 |
print >> sys.stderr, ( |
|
70 |
"Directory %s ignored by pattern %s" |
|
71 |
% (fn, pattern)) |
|
72 |
break |
|
73 |
if bad_name: |
|
74 |
continue |
|
75 |
if (os.path.isfile(os.path.join(fn, '__init__.py')) |
|
76 |
and not prefix): |
|
77 |
if not package: |
|
78 |
new_package = name |
|
79 |
else: |
|
80 |
new_package = package + '.' + name |
|
81 |
stack.append((fn, '', new_package, False)) |
|
82 |
else: |
|
83 |
stack.append((fn, prefix + name + '/', package, only_in_packages)) |
|
84 |
elif package or not only_in_packages: |
|
85 |
# is a file |
|
86 |
bad_name = False |
|
87 |
for pattern in exclude: |
|
88 |
if (fnmatchcase(name, pattern) |
|
89 |
or fn.lower() == pattern.lower()): |
|
90 |
bad_name = True |
|
91 |
if show_ignored: |
|
92 |
print >> sys.stderr, ( |
|
93 |
"File %s ignored by pattern %s" |
|
94 |
% (fn, pattern)) |
|
95 |
break |
|
96 |
if bad_name: |
|
97 |
continue |
|
98 |
out.setdefault(package, []).append(prefix+name) |
|
99 |
return out |
|
100 |
|
|
15 | 101 |
from cloudcms import version |
16 | 102 |
VERSION = version.__version__ |
17 | 103 |
|
... | ... | |
30 | 116 |
packages = find_packages('.'), |
31 | 117 |
package_dir= {'': '.'}, |
32 | 118 |
include_package_data = True, |
119 |
package_data=find_package_data('.'), |
|
33 | 120 |
zip_safe = False, |
34 | 121 |
|
35 | 122 |
install_requires = INSTALL_REQUIRES, |
Also available in: Unified diff