mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Packaging cleanup: remove conditionals for < 2.6 support.
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 commit is contained in:
parent
37ccd6f794
commit
7724a6c10c
16 changed files with 47 additions and 96 deletions
|
@ -326,7 +326,7 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None,
|
|||
"""
|
||||
# nothing is done if sys.dont_write_bytecode is True
|
||||
# FIXME this should not raise an error
|
||||
if hasattr(sys, 'dont_write_bytecode') and sys.dont_write_bytecode:
|
||||
if sys.dont_write_bytecode:
|
||||
raise PackagingByteCompileError('byte-compiling is disabled.')
|
||||
|
||||
# First, if the caller didn't force us into direct or indirect mode,
|
||||
|
@ -346,8 +346,10 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None,
|
|||
# run it with the appropriate flags.
|
||||
if not direct:
|
||||
from tempfile import mkstemp
|
||||
# XXX script_fd may leak, use something better than mkstemp
|
||||
# XXX use something better than mkstemp
|
||||
script_fd, script_name = mkstemp(".py")
|
||||
os.close(script_fd)
|
||||
script_fd = None
|
||||
logger.info("writing byte-compilation script '%s'", script_name)
|
||||
if not dry_run:
|
||||
if script_fd is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue