[Python-checkins] python/dist/src/Lib/distutils ccompiler.py,1.45,1.46

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Tue, 18 Jun 2002 11:42:43 -0700


Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory usw-pr-cvs1:/tmp/cvs-serv9464

Modified Files:
	ccompiler.py 
Log Message:
Add a default implementation of compile() to the base class.

The default implementation calls _compile() to compile individual
files.  This method must be implemented by the subclass.  This change
factors out most of the remaining common code in all the compilers
except mwerks.


Index: ccompiler.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** ccompiler.py	13 Jun 2002 17:26:30 -0000	1.45
--- ccompiler.py	18 Jun 2002 18:42:41 -0000	1.46
***************
*** 645,650 ****
          Raises CompileError on failure.
          """
-         pass
  
  
      def create_static_lib (self,
--- 645,669 ----
          Raises CompileError on failure.
          """
  
+         # A concrete compiler class can either override this method
+         # entirely or implement _compile().
+         
+         macros, objects, extra_postargs, pp_opts, build = \
+                 self._setup_compile(output_dir, macros, include_dirs, sources,
+                                     depends, extra_postargs)
+         cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
+ 
+         for obj, (src, ext) in build.items():
+             self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
+ 
+         # Return *all* object filenames, not just the ones we just built.
+         return objects
+ 
+     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+         """Compile 'src' to product 'obj'."""
+         
+         # A concrete compiler class that does not override compile()
+         # should implement _compile().
+         pass
  
      def create_static_lib (self,