diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-12-23 10:20:49 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-12-23 10:20:49 -0500 |
commit | 2b880cc89d0ce6845c4bdd072ac518a7ed9baa08 (patch) | |
tree | 5d64cf74ea01faa2edd8e09f542e6f5a79b55294 | |
parent | b19c06058c720418db8a4496410cb82cc3526d54 (diff) | |
download | external_python_setuptools-2b880cc89d0ce6845c4bdd072ac518a7ed9baa08.tar.gz external_python_setuptools-2b880cc89d0ce6845c4bdd072ac518a7ed9baa08.tar.bz2 external_python_setuptools-2b880cc89d0ce6845c4bdd072ac518a7ed9baa08.zip |
Use itertools.product to pair each base with each extension.
-rw-r--r-- | setuptools/command/build_ext.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index c85351b4..2651beae 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -6,6 +6,7 @@ from distutils.errors import DistutilsError from distutils import log import os import sys +import itertools from setuptools.extension import Library @@ -199,15 +200,16 @@ class build_ext(_build_ext): return _build_ext.get_outputs(self) + self.__get_stubs_outputs() def __get_stubs_outputs(self): - outputs = [] fn_exts = ['.py', '.pyc'] if self.get_finalized_command('build_py').optimize: fn_exts.append('.pyo') ns_ext = (ext for ext in self.extensions if ext._needs_stub) - for ext in ns_ext: - base = os.path.join(self.build_lib, *ext._full_name.split('.')) - outputs.extend(base + fnext for fnext in fn_exts) - return outputs + ns_ext_bases = ( + os.path.join(self.build_lib, *ext._full_name.split('.')) + for ext in ns_ext + ) + pairs = itertools.product(ns_ext_bases, fn_exts) + return (base + fnext for base, fnext in pairs) def write_stub(self, output_dir, ext, compile=False): log.info("writing stub loader for %s to %s", ext._full_name, |