|
18 | 18 | from glob import glob
|
19 | 19 | from subprocess import check_call
|
20 | 20 |
|
21 |
| -from setuptools import Command |
| 21 | +from setuptools import Command, find_packages |
22 | 22 | from setuptools.command.build_py import build_py
|
23 | 23 | from setuptools.command.sdist import sdist
|
24 | 24 | from setuptools.command.develop import develop
|
@@ -82,26 +82,17 @@ def expand_data_files(data_file_patterns):
|
82 | 82 | return data_files
|
83 | 83 |
|
84 | 84 |
|
85 |
| -def find_packages(top): |
86 |
| - """ |
87 |
| - Find all of the packages. |
88 |
| - """ |
89 |
| - packages = [] |
90 |
| - for d, dirs, _ in os.walk(top, followlinks=True): |
91 |
| - if os.path.exists(pjoin(d, '__init__.py')): |
92 |
| - packages.append(os.path.relpath(d, top).replace(os.path.sep, '.')) |
93 |
| - elif d != top: |
94 |
| - # Do not look for packages in subfolders if current is not a package |
95 |
| - dirs[:] = [] |
96 |
| - return packages |
97 |
| - |
98 |
| - |
99 | 85 | def update_package_data(distribution):
|
100 | 86 | """update build_py options to get package_data changes"""
|
101 | 87 | build_py = distribution.get_command_obj('build_py')
|
102 | 88 | build_py.finalize_options()
|
103 | 89 |
|
104 | 90 |
|
| 91 | +def update_packages(command): |
| 92 | + """update build_py options to get packages changes""" |
| 93 | + command.distribution.packages = find_packages() |
| 94 | + |
| 95 | + |
105 | 96 | def create_cmdclass(wrappers=None):
|
106 | 97 | """Create a command class with the given optional wrappers.
|
107 | 98 |
|
@@ -377,6 +368,8 @@ def run(self):
|
377 | 368 | else:
|
378 | 369 | pass
|
379 | 370 |
|
| 371 | + update_packages(self) |
| 372 | + |
380 | 373 | result = cls.run(self)
|
381 | 374 | # update package data
|
382 | 375 | update_package_data(self.distribution)
|
|
0 commit comments