summaryrefslogtreecommitdiff
path: root/Lib/distutils/command/install_lib.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-03-29 03:29:34 +0000
committerGreg Ward <gward@python.net>2000-03-29 03:29:34 +0000
commit3ebf2f2d2f7795e65edf8a06a8a9841b3dc63acd (patch)
tree81f2e7a10ff4b9a50ed0682f324ceb14f83df25f /Lib/distutils/command/install_lib.py
parent954a2baeb368337e91a116750ebdd1bdb84640ca (diff)
downloadcpython-3ebf2f2d2f7795e65edf8a06a8a9841b3dc63acd.tar.gz
Patch inspired by Bastian Kleineidam <calvin@cs.uni-sb.de>:
use global __debug__ flag to determine if compiled files will be ".pyc" or ".pyo". Tweaked compilation output messages too.
Diffstat (limited to 'Lib/distutils/command/install_lib.py')
-rw-r--r--Lib/distutils/command/install_lib.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py
index 7e1f2e2a4d..64f7cbcf27 100644
--- a/Lib/distutils/command/install_lib.py
+++ b/Lib/distutils/command/install_lib.py
@@ -59,21 +59,16 @@ class install_lib (Command):
from py_compile import compile
for f in outfiles:
- # XXX can't assume this filename mapping! (what if
- # we're running under "python -O"?)
-
# only compile the file if it is actually a .py file
if f[-3:] == '.py':
- out_fn = string.replace (f, '.py', '.pyc')
-
+ out_fn = f + (__debug__ and "c" or "o")
+ compile_msg = "byte-compiling %s to %s" % \
+ (f, os.path.basename (out_fn))
+ skip_msg = "byte-compilation of %s skipped" % f
self.make_file (f, out_fn, compile, (f,),
- "byte-compiling %s" % f,
- "byte-compilation of %s skipped" % f)
-
- # XXX ignore self.optimize for now, since we don't really know if
- # we're compiling optimally or not, and couldn't pick what to do
- # even if we did know. ;-(
-
+ compile_msg, skip_msg)
+
+
# run ()