summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2001-08-16 20:17:41 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2001-08-16 20:17:41 (GMT)
commitdb7aed5219b5c96db0eeb33262f986faa515d6bc (patch)
tree56ec63f36784f8262df0fa88fb65c73ae7bdeae7
parent4d2dded044314c0ff881217c70a532b10170b64d (diff)
downloadcpython-db7aed5219b5c96db0eeb33262f986faa515d6bc.zip
cpython-db7aed5219b5c96db0eeb33262f986faa515d6bc.tar.gz
cpython-db7aed5219b5c96db0eeb33262f986faa515d6bc.tar.bz2
[Patch #441691] preprocess() method for Borland C compiler.
I have no way of testing this.
-rw-r--r--Lib/distutils/bcppcompiler.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py
index 2742b5f..5c0fae8 100644
--- a/Lib/distutils/bcppcompiler.py
+++ b/Lib/distutils/bcppcompiler.py
@@ -21,7 +21,7 @@ from distutils.errors import \
from distutils.ccompiler import \
CCompiler, gen_preprocess_options, gen_lib_options
from distutils.file_util import write_file
-
+from distutils.dep_util import newer
class BCPPCompiler(CCompiler) :
"""Concrete class that implements an interface to the Borland C/C++
@@ -373,3 +373,37 @@ class BCPPCompiler(CCompiler) :
return obj_names
# object_filenames ()
+
+ def preprocess (self,
+ source,
+ output_file=None,
+ macros=None,
+ include_dirs=None,
+ extra_preargs=None,
+ extra_postargs=None):
+
+ (_, macros, include_dirs) = \
+ self._fix_compile_args(None, macros, include_dirs)
+ pp_opts = gen_preprocess_options(macros, include_dirs)
+ pp_args = ['cpp32.exe'] + pp_opts
+ if output_file is not None:
+ pp_args.append('-o' + output_file)
+ if extra_preargs:
+ pp_args[:0] = extra_preargs
+ if extra_postargs:
+ pp_args.extend(extra_postargs)
+ pp_args.append(source)
+
+ # We need to preprocess: either we're being forced to, or the
+ # source file is newer than the target (or the target doesn't
+ # exist).
+ if self.force or output_file is None or newer(source, output_file):
+ if output_file:
+ self.mkpath(os.path.dirname(output_file))
+ try:
+ self.spawn(pp_args)
+ except DistutilsExecError, msg:
+ print msg
+ raise CompileError, msg
+
+ # preprocess()