diff options
author | Éric Araujo <merwok@netwok.org> | 2011-09-17 01:31:51 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-09-17 01:31:51 (GMT) |
commit | 7724a6c10c56a1b14b4933de368e672eae840f47 (patch) | |
tree | 1b3bd60ab9b79bd018cbc942a8e12140b2e18576 /Lib/packaging/util.py | |
parent | 37ccd6f794539e0678b7a7ad938e571cc73e106c (diff) | |
download | cpython-7724a6c10c56a1b14b4933de368e672eae840f47.zip cpython-7724a6c10c56a1b14b4933de368e672eae840f47.tar.gz cpython-7724a6c10c56a1b14b4933de368e672eae840f47.tar.bz2 |
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).
Diffstat (limited to 'Lib/packaging/util.py')
-rw-r--r-- | Lib/packaging/util.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/packaging/util.py b/Lib/packaging/util.py index 49c5991..89f5389 100644 --- a/Lib/packaging/util.py +++ b/Lib/packaging/util.py @@ -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: |