[Python-checkins] CVS: python/dist/src/Lib/distutils bcppcompiler.py,1.9,1.10
A.M. Kuchling
akuchling@users.sourceforge.net
Thu, 16 Aug 2001 13:17:44 -0700
Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory usw-pr-cvs1:/tmp/cvs-serv8137
Modified Files:
bcppcompiler.py
Log Message:
[Patch #441691] preprocess() method for Borland C compiler.
I have no way of testing this.
Index: bcppcompiler.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/bcppcompiler.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** bcppcompiler.py 2001/08/09 21:02:34 1.9
--- bcppcompiler.py 2001/08/16 20:17:41 1.10
***************
*** 22,26 ****
CCompiler, gen_preprocess_options, gen_lib_options
from distutils.file_util import write_file
!
class BCPPCompiler(CCompiler) :
--- 22,26 ----
CCompiler, gen_preprocess_options, gen_lib_options
from distutils.file_util import write_file
! from distutils.dep_util import newer
class BCPPCompiler(CCompiler) :
***************
*** 374,375 ****
--- 374,409 ----
# 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()