diff options
author | Greg Ward <gward@python.net> | 1999-08-29 18:19:37 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 1999-08-29 18:19:37 (GMT) |
commit | 440e2f51ea2b5b7d1db0c31b2e836ec9c8a102d4 (patch) | |
tree | 46439c773e233c346e46fcf98e136f05c78ef5bb | |
parent | 5d60fcf02a7050a07067a12c7a98c8b6b1e68372 (diff) | |
download | cpython-440e2f51ea2b5b7d1db0c31b2e836ec9c8a102d4.zip cpython-440e2f51ea2b5b7d1db0c31b2e836ec9c8a102d4.tar.gz cpython-440e2f51ea2b5b7d1db0c31b2e836ec9c8a102d4.tar.bz2 |
Patch from Perry Stoll: typo fix, make sure we only compile .py files.
-rw-r--r-- | Lib/distutils/command/install_lib.py | 15 | ||||
-rw-r--r-- | Lib/distutils/command/install_py.py | 15 |
2 files changed, 18 insertions, 12 deletions
diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py index f147af4..876a34c 100644 --- a/Lib/distutils/command/install_lib.py +++ b/Lib/distutils/command/install_lib.py @@ -9,7 +9,7 @@ from distutils.util import copy_tree class InstallPy (Command): options = [('dir=', 'd', "directory to install to"), - ('build-dir=' 'b', "build directory (where to install from)"), + ('build-dir=','b', "build directory (where to install from)"), ('compile', 'c', "compile .py to .pyc"), ('optimize', 'o', "compile .py to .pyo (optimized)"), ] @@ -54,12 +54,15 @@ class InstallPy (Command): for f in outfiles: # XXX can't assume this filename mapping! - out_fn = string.replace (f, '.py', '.pyc') - - self.make_file (f, out_fn, compile, (f,), - "compiling %s -> %s" % (f, out_fn), - "compilation of %s skipped" % f) + # only compile the file if it is actually a .py file + if f[-3:] == '.py': + out_fn = string.replace (f, '.py', '.pyc') + + self.make_file (f, out_fn, compile, (f,), + "compiling %s -> %s" % (f, out_fn), + "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. ;-( diff --git a/Lib/distutils/command/install_py.py b/Lib/distutils/command/install_py.py index f147af4..876a34c 100644 --- a/Lib/distutils/command/install_py.py +++ b/Lib/distutils/command/install_py.py @@ -9,7 +9,7 @@ from distutils.util import copy_tree class InstallPy (Command): options = [('dir=', 'd', "directory to install to"), - ('build-dir=' 'b', "build directory (where to install from)"), + ('build-dir=','b', "build directory (where to install from)"), ('compile', 'c', "compile .py to .pyc"), ('optimize', 'o', "compile .py to .pyo (optimized)"), ] @@ -54,12 +54,15 @@ class InstallPy (Command): for f in outfiles: # XXX can't assume this filename mapping! - out_fn = string.replace (f, '.py', '.pyc') - - self.make_file (f, out_fn, compile, (f,), - "compiling %s -> %s" % (f, out_fn), - "compilation of %s skipped" % f) + # only compile the file if it is actually a .py file + if f[-3:] == '.py': + out_fn = string.replace (f, '.py', '.pyc') + + self.make_file (f, out_fn, compile, (f,), + "compiling %s -> %s" % (f, out_fn), + "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. ;-( |