diff options
| author | Éric Araujo <merwok@netwok.org> | 2011-10-09 05:32:35 (GMT) |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2011-10-09 05:32:35 (GMT) |
| commit | a5bc34fa00602911f1ab870456d1319af1cd6391 (patch) | |
| tree | 708d2d803179fa6f2440204de3a0f6f0b35c7df8 /Lib/distutils/util.py | |
| parent | c0bbe7d38a9a7b43de4a921876072662ba5c82fc (diff) | |
| parent | 5819dcc0d262ef0ceaffc68d1b65f3d031e27b68 (diff) | |
| download | cpython-a5bc34fa00602911f1ab870456d1319af1cd6391.zip cpython-a5bc34fa00602911f1ab870456d1319af1cd6391.tar.gz cpython-a5bc34fa00602911f1ab870456d1319af1cd6391.tar.bz2 | |
Branch merge
Diffstat (limited to 'Lib/distutils/util.py')
| -rw-r--r-- | Lib/distutils/util.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 023ddff..f42c6a1 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -4,7 +4,11 @@ Miscellaneous utility functions -- anything that doesn't fit into one of the other *util.py modules. """ -import sys, os, string, re +import os +import re +import imp +import sys +import string from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn @@ -415,9 +419,9 @@ def byte_compile (py_files, verbose=1, dry_run=0, direct=None): """Byte-compile a collection of Python source files to either .pyc - or .pyo files in the same directory. 'py_files' is a list of files - to compile; any files that don't end in ".py" are silently skipped. - 'optimize' must be one of the following: + or .pyo files in a __pycache__ subdirectory. 'py_files' is a list + of files to compile; any files that don't end in ".py" are silently + skipped. 'optimize' must be one of the following: 0 - don't optimize (generate .pyc) 1 - normal optimization (like "python -O") 2 - extra optimization (like "python -OO") @@ -529,7 +533,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) - cfile = file + (__debug__ and "c" or "o") + if optimize >= 0: + cfile = imp.cache_from_source(file, debug_override=not optimize) + else: + cfile = imp.cache_from_source(file) dfile = file if prefix: if file[:len(prefix)] != prefix: |
