Mercurial > cpython-lru_cache-weakref
annotate Lib/distutils/bcppcompiler.py @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | 3e2b7965ada9 |
| children |
| rev | line source |
|---|---|
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
1 """distutils.bcppcompiler |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
2 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
3 Contains BorlandCCompiler, an implementation of the abstract CCompiler class |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
4 for the Borland C++ compiler. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
5 """ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
6 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
7 # This implementation by Lyle Johnson, based on the original msvccompiler.py |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
8 # module and using the directions originally published by Gordon Williams. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
9 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
10 # XXX looks like there's a LOT of overlap between these two classes: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
11 # someone should sit down and factor out the common code as |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
12 # WindowsCCompiler! --GPW |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
13 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
14 __revision__ = "$Id$" |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
15 |
|
57847
3e2b7965ada9
massive import cleaning in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
16 import os |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
17 |
|
57847
3e2b7965ada9
massive import cleaning in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
18 from distutils.errors import (DistutilsExecError, CompileError, LibError, |
|
3e2b7965ada9
massive import cleaning in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
19 LinkError, UnknownFileError) |
|
3e2b7965ada9
massive import cleaning in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
20 from distutils.ccompiler import CCompiler, gen_preprocess_options |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
21 from distutils.file_util import write_file |
|
19318
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
22 from distutils.dep_util import newer |
|
23668
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
23 from distutils import log |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
24 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
25 class BCPPCompiler(CCompiler) : |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
26 """Concrete class that implements an interface to the Borland C/C++ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
27 compiler, as defined by the CCompiler abstract class. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
28 """ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
29 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
30 compiler_type = 'bcpp' |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
31 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
32 # Just set this so CCompiler's constructor doesn't barf. We currently |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
33 # don't use the 'set_executables()' bureaucracy provided by CCompiler, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
34 # as it really isn't necessary for this sort of single-compiler class. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
35 # Would be nice to have a consistent interface with UnixCCompiler, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
36 # though, so it's worth thinking about. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
37 executables = {} |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
38 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
39 # Private class data (need to distinguish C from C++ source for compiler) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
40 _c_extensions = ['.c'] |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
41 _cpp_extensions = ['.cc', '.cpp', '.cxx'] |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
42 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
43 # Needed for the filename generation methods provided by the |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
44 # base class, CCompiler. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
45 src_extensions = _c_extensions + _cpp_extensions |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
46 obj_extension = '.obj' |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
47 static_lib_extension = '.lib' |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
48 shared_lib_extension = '.dll' |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
49 static_lib_format = shared_lib_format = '%s%s' |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
50 exe_extension = '.exe' |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
51 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
52 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
53 def __init__ (self, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
54 verbose=0, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
55 dry_run=0, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
56 force=0): |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
57 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
58 CCompiler.__init__ (self, verbose, dry_run, force) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
59 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
60 # These executables are assumed to all be in the path. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
61 # Borland doesn't seem to use any special registry settings to |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
62 # indicate their installation locations. |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
63 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
64 self.cc = "bcc32.exe" |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
65 self.linker = "ilink32.exe" |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
66 self.lib = "tlib.exe" |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
67 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
68 self.preprocess_options = None |
| 13951 | 69 self.compile_options = ['/tWM', '/O2', '/q', '/g0'] |
| 70 self.compile_options_debug = ['/tWM', '/Od', '/q', '/g0'] | |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
71 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
72 self.ldflags_shared = ['/Tpd', '/Gn', '/q', '/x'] |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
73 self.ldflags_shared_debug = ['/Tpd', '/Gn', '/q', '/x'] |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
74 self.ldflags_static = [] |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
75 self.ldflags_exe = ['/Gn', '/q', '/x'] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
76 self.ldflags_exe_debug = ['/Gn', '/q', '/x','/r'] |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
77 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
78 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
79 # -- Worker methods ------------------------------------------------ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
80 |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
81 def compile(self, sources, |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
82 output_dir=None, macros=None, include_dirs=None, debug=0, |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
83 extra_preargs=None, extra_postargs=None, depends=None): |
|
32736
c3a096bfbd6b
Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents:
31129
diff
changeset
|
84 |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
85 macros, objects, extra_postargs, pp_opts, build = \ |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
86 self._setup_compile(output_dir, macros, include_dirs, sources, |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
87 depends, extra_postargs) |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
88 compile_opts = extra_preargs or [] |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
89 compile_opts.append ('-c') |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
90 if debug: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
91 compile_opts.extend (self.compile_options_debug) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
92 else: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
93 compile_opts.extend (self.compile_options) |
| 21267 | 94 |
|
31129
be9ef9b92d61
Compile the files in the same order they are passed to the compiler.
Thomas Heller <theller@ctypes.org>
parents:
26285
diff
changeset
|
95 for obj in objects: |
|
be9ef9b92d61
Compile the files in the same order they are passed to the compiler.
Thomas Heller <theller@ctypes.org>
parents:
26285
diff
changeset
|
96 try: |
|
be9ef9b92d61
Compile the files in the same order they are passed to the compiler.
Thomas Heller <theller@ctypes.org>
parents:
26285
diff
changeset
|
97 src, ext = build[obj] |
|
be9ef9b92d61
Compile the files in the same order they are passed to the compiler.
Thomas Heller <theller@ctypes.org>
parents:
26285
diff
changeset
|
98 except KeyError: |
|
be9ef9b92d61
Compile the files in the same order they are passed to the compiler.
Thomas Heller <theller@ctypes.org>
parents:
26285
diff
changeset
|
99 continue |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
100 # XXX why do the normpath here? |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
101 src = os.path.normpath(src) |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
102 obj = os.path.normpath(obj) |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
103 # XXX _setup_compile() did a mkpath() too but before the normpath. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
104 # Is it possible to skip the normpath? |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
105 self.mkpath(os.path.dirname(obj)) |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
106 |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
107 if ext == '.res': |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
108 # This is already a binary file -- skip it. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
109 continue # the 'for' loop |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
110 if ext == '.rc': |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
111 # This needs to be compiled to a .res file -- do it now. |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
112 try: |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
113 self.spawn (["brcc32", "-fo", obj, src]) |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
114 except DistutilsExecError, msg: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
115 raise CompileError, msg |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
116 continue # the 'for' loop |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
117 |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
118 # The next two are both for the real compiler. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
119 if ext in self._c_extensions: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
120 input_opt = "" |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
121 elif ext in self._cpp_extensions: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
122 input_opt = "-P" |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
123 else: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
124 # Unknown file type -- no extra options. The compiler |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
125 # will probably fail, but let it just in case this is a |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
126 # file the compiler recognizes even if we don't. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
127 input_opt = "" |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
128 |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
129 output_opt = "-o" + obj |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
130 |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
131 # Compiler command line syntax is: "bcc32 [options] file(s)". |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
132 # Note that the source file names must appear at the end of |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
133 # the command line. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
134 try: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
135 self.spawn ([self.cc] + compile_opts + pp_opts + |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
136 [input_opt, output_opt] + |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
137 extra_postargs + [src]) |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
138 except DistutilsExecError, msg: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
139 raise CompileError, msg |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
140 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
141 return objects |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
142 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
143 # compile () |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
144 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
145 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
146 def create_static_lib (self, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
147 objects, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
148 output_libname, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
149 output_dir=None, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
150 debug=0, |
|
26036
771b6f521b95
This patch fixes the following bugs:
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
23823
diff
changeset
|
151 target_lang=None): |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
152 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
153 (objects, output_dir) = self._fix_object_args (objects, output_dir) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
154 output_filename = \ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
155 self.library_filename (output_libname, output_dir=output_dir) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
156 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
157 if self._need_link (objects, output_filename): |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
158 lib_args = [output_filename, '/u'] + objects |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
159 if debug: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
160 pass # XXX what goes here? |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
161 try: |
| 21267 | 162 self.spawn ([self.lib] + lib_args) |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
163 except DistutilsExecError, msg: |
| 21267 | 164 raise LibError, msg |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
165 else: |
|
23668
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
166 log.debug("skipping %s (up-to-date)", output_filename) |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
167 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
168 # create_static_lib () |
| 21267 | 169 |
| 170 | |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
171 def link (self, |
| 21267 | 172 target_desc, |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
173 objects, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
174 output_filename, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
175 output_dir=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
176 libraries=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
177 library_dirs=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
178 runtime_library_dirs=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
179 export_symbols=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
180 debug=0, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
181 extra_preargs=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
182 extra_postargs=None, |
|
26036
771b6f521b95
This patch fixes the following bugs:
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
23823
diff
changeset
|
183 build_temp=None, |
|
771b6f521b95
This patch fixes the following bugs:
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
23823
diff
changeset
|
184 target_lang=None): |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
185 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
186 # XXX this ignores 'build_temp'! should follow the lead of |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
187 # msvccompiler.py |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
188 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
189 (objects, output_dir) = self._fix_object_args (objects, output_dir) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
190 (libraries, library_dirs, runtime_library_dirs) = \ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
191 self._fix_lib_args (libraries, library_dirs, runtime_library_dirs) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
192 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
193 if runtime_library_dirs: |
|
23668
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
194 log.warn("I don't know what to do with 'runtime_library_dirs': %s", |
|
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
195 str(runtime_library_dirs)) |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
196 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
197 if output_dir is not None: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
198 output_filename = os.path.join (output_dir, output_filename) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
199 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
200 if self._need_link (objects, output_filename): |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
201 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
202 # Figure out linker args based on type of target. |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
203 if target_desc == CCompiler.EXECUTABLE: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
204 startup_obj = 'c0w32' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
205 if debug: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
206 ld_args = self.ldflags_exe_debug[:] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
207 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
208 ld_args = self.ldflags_exe[:] |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
209 else: |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
210 startup_obj = 'c0d32' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
211 if debug: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
212 ld_args = self.ldflags_shared_debug[:] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
213 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
214 ld_args = self.ldflags_shared[:] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
215 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
216 |
| 14323 | 217 # Create a temporary exports file for use by the linker |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
218 if export_symbols is None: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
219 def_file = '' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
220 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
221 head, tail = os.path.split (output_filename) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
222 modname, ext = os.path.splitext (tail) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
223 temp_dir = os.path.dirname(objects[0]) # preserve tree structure |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
224 def_file = os.path.join (temp_dir, '%s.def' % modname) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
225 contents = ['EXPORTS'] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
226 for sym in (export_symbols or []): |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
227 contents.append(' %s=_%s' % (sym, sym)) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
228 self.execute(write_file, (def_file, contents), |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
229 "writing %s" % def_file) |
| 14323 | 230 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
231 # Borland C++ has problems with '/' in paths |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
232 objects2 = map(os.path.normpath, objects) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
233 # split objects in .obj and .res files |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
234 # Borland C++ needs them at different positions in the command line |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
235 objects = [startup_obj] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
236 resources = [] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
237 for file in objects2: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
238 (base, ext) = os.path.splitext(os.path.normcase(file)) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
239 if ext == '.res': |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
240 resources.append(file) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
241 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
242 objects.append(file) |
| 21267 | 243 |
| 244 | |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
245 for l in library_dirs: |
| 21267 | 246 ld_args.append("/L%s" % os.path.normpath(l)) |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
247 ld_args.append("/L.") # we sometimes use relative paths |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
248 |
| 21267 | 249 # list of object files |
| 250 ld_args.extend(objects) | |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
251 |
|
13953
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
252 # XXX the command-line syntax for Borland C++ is a bit wonky; |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
253 # certain filenames are jammed together in one big string, but |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
254 # comma-delimited. This doesn't mesh too well with the |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
255 # Unix-centric attitude (with a DOS/Windows quoting hack) of |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
256 # 'spawn()', so constructing the argument list is a bit |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
257 # awkward. Note that doing the obvious thing and jamming all |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
258 # the filenames and commas into one argument would be wrong, |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
259 # because 'spawn()' would quote any filenames with spaces in |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
260 # them. Arghghh!. Apparently it works fine as coded... |
|
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
261 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
262 # name of dll/exe file |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
263 ld_args.extend([',',output_filename]) |
| 21267 | 264 # no map file and start libraries |
| 13951 | 265 ld_args.append(',,') |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
266 |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
267 for lib in libraries: |
| 21267 | 268 # see if we find it and if there is a bcpp specific lib |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
269 # (xxx_bcpp.lib) |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
270 libfile = self.find_library_file(library_dirs, lib, debug) |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
271 if libfile is None: |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
272 ld_args.append(lib) |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
273 # probably a BCPP internal library -- don't warn |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
274 else: |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
275 # full name which prefers bcpp_xxx.lib over xxx.lib |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
276 ld_args.append(libfile) |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
277 |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
278 # some default libraries |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
279 ld_args.append ('import32') |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
280 ld_args.append ('cw32mt') |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
281 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
282 # def file for export symbols |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
283 ld_args.extend([',',def_file]) |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
284 # add resource files |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
285 ld_args.append(',') |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
286 ld_args.extend(resources) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
287 |
| 21267 | 288 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
289 if extra_preargs: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
290 ld_args[:0] = extra_preargs |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
291 if extra_postargs: |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
292 ld_args.extend(extra_postargs) |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
293 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
294 self.mkpath (os.path.dirname (output_filename)) |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
295 try: |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
296 self.spawn ([self.linker] + ld_args) |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
297 except DistutilsExecError, msg: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
298 raise LinkError, msg |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
299 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
300 else: |
|
23668
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
301 log.debug("skipping %s (up-to-date)", output_filename) |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
302 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
303 # link () |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
304 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
305 # -- Miscellaneous methods ----------------------------------------- |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
306 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
307 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
308 def find_library_file (self, dirs, lib, debug=0): |
|
13845
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
309 # List of effective library names to try, in order of preference: |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
310 # xxx_bcpp.lib is better than xxx.lib |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
311 # and xxx_d.lib is better than xxx.lib if debug is set |
|
13845
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
312 # |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
313 # The "_bcpp" suffix is to handle a Python installation for people |
|
13845
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
314 # with multiple compilers (primarily Distutils hackers, I suspect |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
315 # ;-). The idea is they'd have one static library for each |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
316 # compiler they care about, since (almost?) every Windows compiler |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
317 # seems to have a different format for static libraries. |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
318 if debug: |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
319 dlib = (lib + "_d") |
| 14323 | 320 try_names = (dlib + "_bcpp", lib + "_bcpp", dlib, lib) |
|
13845
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
321 else: |
| 14323 | 322 try_names = (lib + "_bcpp", lib) |
|
13845
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
323 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
324 for dir in dirs: |
|
13845
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
325 for name in try_names: |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
326 libfile = os.path.join(dir, self.library_filename(name)) |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
327 if os.path.exists(libfile): |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
328 return libfile |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
329 else: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
330 # Oops, didn't find it in *any* of 'dirs' |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
331 return None |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
332 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
333 # overwrite the one from CCompiler to support rc and res-files |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
334 def object_filenames (self, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
335 source_filenames, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
336 strip_dir=0, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
337 output_dir=''): |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
338 if output_dir is None: output_dir = '' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
339 obj_names = [] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
340 for src_name in source_filenames: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
341 # use normcase to make sure '.rc' is really '.rc' and not '.RC' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
342 (base, ext) = os.path.splitext (os.path.normcase(src_name)) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
343 if ext not in (self.src_extensions + ['.rc','.res']): |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
344 raise UnknownFileError, \ |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
345 "unknown file type '%s' (from '%s')" % \ |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
346 (ext, src_name) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
347 if strip_dir: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
348 base = os.path.basename (base) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
349 if ext == '.res': |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
350 # these can go unchanged |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
351 obj_names.append (os.path.join (output_dir, base + ext)) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
352 elif ext == '.rc': |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
353 # these need to be compiled to .res-files |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
354 obj_names.append (os.path.join (output_dir, base + '.res')) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
355 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
356 obj_names.append (os.path.join (output_dir, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
357 base + self.obj_extension)) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
358 return obj_names |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
359 |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
360 # object_filenames () |
|
19318
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
361 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
362 def preprocess (self, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
363 source, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
364 output_file=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
365 macros=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
366 include_dirs=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
367 extra_preargs=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
368 extra_postargs=None): |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
369 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
370 (_, macros, include_dirs) = \ |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
371 self._fix_compile_args(None, macros, include_dirs) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
372 pp_opts = gen_preprocess_options(macros, include_dirs) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
373 pp_args = ['cpp32.exe'] + pp_opts |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
374 if output_file is not None: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
375 pp_args.append('-o' + output_file) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
376 if extra_preargs: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
377 pp_args[:0] = extra_preargs |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
378 if extra_postargs: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
379 pp_args.extend(extra_postargs) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
380 pp_args.append(source) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
381 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
382 # We need to preprocess: either we're being forced to, or the |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
383 # source file is newer than the target (or the target doesn't |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
384 # exist). |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
385 if self.force or output_file is None or newer(source, output_file): |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
386 if output_file: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
387 self.mkpath(os.path.dirname(output_file)) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
388 try: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
389 self.spawn(pp_args) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
390 except DistutilsExecError, msg: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
391 print msg |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
392 raise CompileError, msg |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
393 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
394 # preprocess() |
