20 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
20 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
21 """Generic Setup script, takes package info from __pkginfo__.py file |
21 """Generic Setup script, takes package info from __pkginfo__.py file |
22 """ |
22 """ |
23 |
23 |
24 import io |
24 import io |
25 import os |
25 from os.path import dirname, join |
26 from os.path import dirname, exists, isdir, join |
|
27 |
26 |
28 from setuptools import setup |
27 from setuptools import setup, find_packages |
29 |
28 |
30 |
29 |
31 here = dirname(__file__) |
30 here = dirname(__file__) |
32 |
31 |
33 # import required features |
32 # import required features |
50 distname = __pkginfo__['distname'] |
49 distname = __pkginfo__['distname'] |
51 data_files = __pkginfo__['data_files'] |
50 data_files = __pkginfo__['data_files'] |
52 package_data = __pkginfo__['package_data'] |
51 package_data = __pkginfo__['package_data'] |
53 |
52 |
54 |
53 |
55 def get_packages(directory, prefix): |
|
56 """return a list of subpackages for the given directory |
|
57 """ |
|
58 result = [] |
|
59 for package in os.listdir(directory): |
|
60 absfile = join(directory, package) |
|
61 if isdir(absfile): |
|
62 if exists(join(absfile, '__init__.py')) or \ |
|
63 package in ('test', 'tests'): |
|
64 if prefix: |
|
65 result.append('%s.%s' % (prefix, package)) |
|
66 else: |
|
67 result.append(package) |
|
68 result += get_packages(absfile, result[-1]) |
|
69 return result |
|
70 |
|
71 |
|
72 setup( |
54 setup( |
73 name=distname, |
55 name=distname, |
74 version=version, |
56 version=version, |
75 license=license, |
57 license=license, |
76 url=web, |
58 url=web, |
77 description=description, |
59 description=description, |
78 long_description=long_description, |
60 long_description=long_description, |
79 author=author, |
61 author=author, |
80 author_email=author_email, |
62 author_email=author_email, |
81 packages=[modname] + get_packages(join(here, modname), modname), |
63 packages=find_packages(), |
82 package_data=package_data, |
64 package_data=package_data, |
83 data_files=data_files, |
65 data_files=data_files, |
84 include_package_data=True, |
66 include_package_data=True, |
85 install_requires=[ |
67 install_requires=[ |
86 'six >= 1.4.0', |
68 'six >= 1.4.0', |