]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch from Perry Stoll: typo fix, make sure we only compile .py files.
authorGreg Ward <gward@python.net>
Sun, 29 Aug 1999 18:19:37 +0000 (18:19 +0000)
committerGreg Ward <gward@python.net>
Sun, 29 Aug 1999 18:19:37 +0000 (18:19 +0000)
Lib/distutils/command/install_lib.py
Lib/distutils/command/install_py.py

index f147af47f300f2039dc8084dfcba5a8cf8a43392..876a34ce61fa91886eee7a91b60ededf8076d7df 100644 (file)
@@ -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.  ;-(
index f147af47f300f2039dc8084dfcba5a8cf8a43392..876a34ce61fa91886eee7a91b60ededf8076d7df 100644 (file)
@@ -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.  ;-(