diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-05-22 15:18:04 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-05-22 15:18:04 -0400 |
commit | 2d765a69b19bb92882582249942d607684dd14eb (patch) | |
tree | 0f310339ca646e0e1e03c56fb322bbd7c70bba1a /setuptools/command/build_py.py | |
parent | efecaf8cdb7ca4623d2efd53590adf976fd36954 (diff) | |
download | external_python_setuptools-2d765a69b19bb92882582249942d607684dd14eb.tar.gz external_python_setuptools-2d765a69b19bb92882582249942d607684dd14eb.tar.bz2 external_python_setuptools-2d765a69b19bb92882582249942d607684dd14eb.zip |
Refactor build_py.find_data_files to use iterables, constructing the files list directly. Ref #261.
Diffstat (limited to 'setuptools/command/build_py.py')
-rw-r--r-- | setuptools/command/build_py.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index 3849b6ad..34f39037 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -98,10 +98,18 @@ class build_py(orig.build_py, Mixin2to3): self.package_data.get('', []), self.package_data.get(package, []), ) - files = self.manifest_files.get(package, [])[:] - for pattern in globs: + globs_expanded = ( # Each pattern has to be converted to a platform-specific path - files.extend(glob(os.path.join(src_dir, convert_path(pattern)))) + glob(os.path.join(src_dir, convert_path(pattern))) + for pattern in globs + ) + # flatten the expanded globs into an iterable of matches + globs_matches = itertools.chain.from_iterable(globs_expanded) + glob_files = globs_matches + files = list(itertools.chain( + self.manifest_files.get(package, []), + glob_files, + )) return self.exclude_data_files(package, src_dir, files) def build_package_data(self): |