diff options
author | Éric Araujo <merwok@netwok.org> | 2011-11-03 16:44:13 +0100 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-11-03 16:44:13 +0100 |
commit | 146f870916539eb2e7b9273eb8ff978bc55ec961 (patch) | |
tree | fe68304b52d99f6848752b2ae0a1f1d76928b995 /Lib/packaging/util.py | |
parent | ef297a8a35efc57aa20045faf758d224b35c4634 (diff) | |
parent | 7855a1abec947dfb05fbb79393d972af02403bab (diff) | |
download | cpython-git-146f870916539eb2e7b9273eb8ff978bc55ec961.tar.gz |
Branch merge
Diffstat (limited to 'Lib/packaging/util.py')
-rw-r--r-- | Lib/packaging/util.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Lib/packaging/util.py b/Lib/packaging/util.py index 8dd715fe11..e76e3c32a7 100644 --- a/Lib/packaging/util.py +++ b/Lib/packaging/util.py @@ -20,8 +20,8 @@ from configparser import RawConfigParser from packaging import logger from packaging.errors import (PackagingPlatformError, PackagingFileError, - PackagingByteCompileError, PackagingExecError, - InstallationException, PackagingInternalError) + PackagingExecError, InstallationException, + PackagingInternalError) __all__ = [ # file dependencies @@ -325,12 +325,10 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None, the source for details). The 'direct' flag is used by the script generated in indirect mode; unless you know what you're doing, leave it set to None. - """ - # nothing is done if sys.dont_write_bytecode is True - # FIXME this should not raise an error - if sys.dont_write_bytecode: - raise PackagingByteCompileError('byte-compiling is disabled.') + This function is independent from the running Python's -O or -B options; + it is fully controlled by the parameters passed in. + """ # First, if the caller didn't force us into direct or indirect mode, # figure out which mode we should be in. We take a conservative # approach: choose direct mode *only* if the current interpreter is @@ -417,12 +415,10 @@ byte_compile(files, optimize=%r, force=%r, # Terminology from the py_compile module: # cfile - byte-compiled file # dfile - purported source filename (same as 'file' by default) - if optimize >= 0: - cfile = imp.cache_from_source(file, - debug_override=not optimize) - else: - cfile = imp.cache_from_source(file) + debug_override = not optimize + cfile = imp.cache_from_source(file, debug_override) dfile = file + if prefix: if file[:len(prefix)] != prefix: raise ValueError("invalid prefix: filename %r doesn't " |