]> granicus.if.org Git - python/commit
Improve byte-compilation in packaging to be independent of -O or -B.
authorÉric Araujo <merwok@netwok.org>
Thu, 3 Nov 2011 04:08:28 +0000 (05:08 +0100)
committerÉric Araujo <merwok@netwok.org>
Thu, 3 Nov 2011 04:08:28 +0000 (05:08 +0100)
commit880801501b778d93079afc11672dba86e60eab94
tree32bad2da11ff3f125f67e46d93c308f18c311eab
parentdfd232898d4ae64a4c176ed492eec5e1ab209ef8
Improve byte-compilation in packaging to be independent of -O or -B.

The code I fixed to comply with PEP 3147 still had one bug: When run
under python -O, some paths for pyc files would be pyo, because I called
imp.cache_from_source without explicit debug_override argument in some
places, and under -O that would return .pyo (this is well explained in
the imp docs).  Now all code (util.byte_compile, build_py, install_lib)
can create .pyo files according to options given by users,
without interference from the calling Python’s own optimize mode.

On a related topic, I also removed the code that prevented byte
compilation under python -B.  The rationale is that packaging gives
control over the creation of pyc files to the user with its own explicit
option, and the behavior should not be changed if the calling Python
happens to run with -B for whatever reason.  I will argue that this is a
bug fix and ask to be allowed to backport this change to distutils.

Finally, I moved one nugget of information about the --compile and
--optimize options from the source into the doc.  It clears up a
misunderstanding that I (and maybe other people) had.
13 files changed:
Doc/library/packaging.util.rst
Doc/packaging/builtdist.rst
Doc/packaging/commandref.rst
Lib/packaging/command/build_py.py
Lib/packaging/command/install_lib.py
Lib/packaging/errors.py
Lib/packaging/tests/support.py
Lib/packaging/tests/test_command_build_py.py
Lib/packaging/tests/test_command_install_lib.py
Lib/packaging/tests/test_mixin2to3.py
Lib/packaging/tests/test_util.py
Lib/packaging/util.py
Misc/NEWS