I want to replace custom byte-compiling function with calls to
compileall before 3.3b1, but in the short term it’s good to have this
fixed.
Adapted from the distutils patch by Jeff Ramnani. I tested with -B, -O
and -OO; test_util and test_mixin2to3 fail in -O mode because lib2to3
doesn’t support it.
PEP 370 features and sys.dont_write_bytecode are always available
in 3.3; the distutils2 backport still has the conditionals.
I also renamed an internal misnamed method and fixed a few things
(“packaging2” name, stray print, unused import, fd leak).
This huge module is the heir of six distutils modules, and contains
a number of miscellaneous functions. I have attempted to help readers
of the source code with an annoted __all__. Removed or deprecated
functions have been removed from the documentation; I’m working on
another patch to document the remaining public functions.
For the curious:
The unzip_file and untar_file were used by (or intended to be used by)
“pysetup install path/to/archive.tar.gz”, but the code presently used
shutil.unpack_archive and an helper function, so I just deleted them.
They’re still in the repository if we need them in the future.
The find_packages function is not used anymore but I want to discuss
module and package auto-discovery (in “pysetup create”) again before
removing it.
subst_vars now lives in sysconfig; rfc822_escape is inlined in
packaging.metadata. Other functions are for internal use only, or
deprecated; I have left them out of __all__ and sprinkled TODO notes
for future cleanups.
This change also makes sure the logger handlers are not alterated after an
installation. That also fixes the remaining environment alteration issue in
test_packaging.