summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2002-06-18 18:42:41 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2002-06-18 18:42:41 (GMT)
commit6e08d22b1a7dabb5456460f152cc5e102cf44ea5 (patch)
tree1d7884b8dd96146f45614d9792103b15507a51e8 /Lib/distutils
parent074712112b73bf2adf56c8f031c7789b6cfd290f (diff)
downloadcpython-6e08d22b1a7dabb5456460f152cc5e102cf44ea5.zip
cpython-6e08d22b1a7dabb5456460f152cc5e102cf44ea5.tar.gz
cpython-6e08d22b1a7dabb5456460f152cc5e102cf44ea5.tar.bz2
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.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/ccompiler.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py
index 50246b8..f1a50cb 100644
--- a/Lib/distutils/ccompiler.py
+++ b/Lib/distutils/ccompiler.py
@@ -644,8 +644,27 @@ class CCompiler:
Raises CompileError on failure.
"""
- pass
+ # 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,
objects,