[Python-checkins] CVS: distutils/distutils/command build_ext.py,1.38,1.39

Greg Ward python-dev@python.org
Thu, 25 May 2000 18:31:56 -0700


Update of /cvsroot/python/distutils/distutils/command
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9754

Modified Files:
	build_ext.py 
Log Message:
Rene Liebscher: check if the extension file (.so or .pyd) is
up-to-date with respect to the source files; that way, we
don't needlessly rebuild just because object files go away.


Index: build_ext.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/build_ext.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** build_ext.py	2000/05/25 01:10:04	1.38
--- build_ext.py	2000/05/26 01:31:53	1.39
***************
*** 7,11 ****
  # created 1999/08/09, Greg Ward
  
! __revision__ = "$Id: build_ext.py,v 1.38 2000/05/25 01:10:04 gward Exp $"
  
  import sys, os, string, re
--- 7,11 ----
  # created 1999/08/09, Greg Ward
  
! __revision__ = "$Id: build_ext.py,v 1.39 2000/05/26 01:31:53 gward Exp $"
  
  import sys, os, string, re
***************
*** 13,18 ****
  from distutils.core import Command
  from distutils.errors import *
  
- 
  # An extension name is just a dot-separated list of Python NAMEs (ie.
  # the same as a fully-qualified module name).
--- 13,18 ----
  from distutils.core import Command
  from distutils.errors import *
+ from distutils.dep_util import newer_group
  
  # An extension name is just a dot-separated list of Python NAMEs (ie.
  # the same as a fully-qualified module name).
***************
*** 285,290 ****
                         "a list of source filenames") % extension_name
              sources = list (sources)
  
!             self.announce ("building '%s' extension" % extension_name)
  
              # First step: compile the source code to object files.  This
--- 285,312 ----
                         "a list of source filenames") % extension_name
              sources = list (sources)
+ 
+             fullname = self.get_ext_fullname (extension_name)
+             if self.inplace:
+                 # ignore build-lib -- put the compiled extension into
+                 # the source tree along with pure Python modules
+ 
+                 modpath = string.split (fullname, '.')
+                 package = string.join (modpath[0:-1], '.')
+                 base = modpath[-1]
+ 
+                 build_py = self.find_peer ('build_py')
+                 package_dir = build_py.get_package_dir (package)
+                 ext_filename = os.path.join (package_dir,
+                                              self.get_ext_filename(base))
+             else:
+                 ext_filename = os.path.join (self.build_lib,
+                                              self.get_ext_filename(fullname))
  
! 	    if not newer_group(sources, ext_filename, 'newer'):
! 	    	self.announce ("skipping '%s' extension (up-to-date)" %
!                                extension_name)
! 		continue # 'for' loop over all extensions
! 	    else:
!         	self.announce ("building '%s' extension" % extension_name)
  
              # First step: compile the source code to object files.  This
***************
*** 357,377 ****
                  self.mkpath (os.path.dirname (implib_file))
              # if MSVC
- 
-             fullname = self.get_ext_fullname (extension_name)
-             if self.inplace:
-                 # ignore build-lib -- put the compiled extension into
-                 # the source tree along with pure Python modules
- 
-                 modpath = string.split (fullname, '.')
-                 package = string.join (modpath[0:-1], '.')
-                 base = modpath[-1]
- 
-                 build_py = self.find_peer ('build_py')
-                 package_dir = build_py.get_package_dir (package)
-                 ext_filename = os.path.join (package_dir,
-                                              self.get_ext_filename(base))
-             else:
-                 ext_filename = os.path.join (self.build_lib,
-                                              self.get_ext_filename(fullname))
  
              self.compiler.link_shared_object (objects, ext_filename, 
--- 379,382 ----