mirror of https://github.com/python/cpython
Added '_bytecode_filenames()' method, and use it in 'get_outputs()'
to ensure that compiled bytecode files are considered part of the output of the "install_lib" command.
This commit is contained in:
parent
f9ebf98725
commit
11fb783fa4
|
@ -72,8 +72,6 @@ class install_lib (Command):
|
||||||
skip_msg = "byte-compilation of %s skipped" % f
|
skip_msg = "byte-compilation of %s skipped" % f
|
||||||
self.make_file (f, out_fn, compile, (f,),
|
self.make_file (f, out_fn, compile, (f,),
|
||||||
compile_msg, skip_msg)
|
compile_msg, skip_msg)
|
||||||
|
|
||||||
|
|
||||||
# run ()
|
# run ()
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,6 +93,14 @@ class install_lib (Command):
|
||||||
|
|
||||||
# _mutate_outputs ()
|
# _mutate_outputs ()
|
||||||
|
|
||||||
|
def _bytecode_filenames (self, py_filenames):
|
||||||
|
bytecode_files = []
|
||||||
|
for py_file in py_filenames:
|
||||||
|
bytecode = py_file + (__debug__ and "c" or "o")
|
||||||
|
bytecode_files.append(bytecode)
|
||||||
|
|
||||||
|
return bytecode_files
|
||||||
|
|
||||||
def get_outputs (self):
|
def get_outputs (self):
|
||||||
"""Return the list of files that would be installed if this command
|
"""Return the list of files that would be installed if this command
|
||||||
were actually run. Not affected by the "dry-run" flag or whether
|
were actually run. Not affected by the "dry-run" flag or whether
|
||||||
|
@ -104,14 +110,17 @@ class install_lib (Command):
|
||||||
self._mutate_outputs (self.distribution.has_pure_modules(),
|
self._mutate_outputs (self.distribution.has_pure_modules(),
|
||||||
'build_py', 'build_lib',
|
'build_py', 'build_lib',
|
||||||
self.install_dir)
|
self.install_dir)
|
||||||
|
if self.compile:
|
||||||
|
bytecode_outputs = self._bytecode_filenames(pure_outputs)
|
||||||
|
else:
|
||||||
|
bytecode_outputs = []
|
||||||
|
|
||||||
ext_outputs = \
|
ext_outputs = \
|
||||||
self._mutate_outputs (self.distribution.has_ext_modules(),
|
self._mutate_outputs (self.distribution.has_ext_modules(),
|
||||||
'build_ext', 'build_lib',
|
'build_ext', 'build_lib',
|
||||||
self.install_dir)
|
self.install_dir)
|
||||||
|
|
||||||
return pure_outputs + ext_outputs
|
return pure_outputs + bytecode_outputs + ext_outputs
|
||||||
|
|
||||||
# get_outputs ()
|
# get_outputs ()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue