Mercurial > cpython-lru_cache-weakref
annotate Lib/distutils/bcppcompiler.py @ 54294:dba767bc3155 legacy-trunk
remove mention of old ctypes version
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 23 May 2009 20:59:09 +0000 |
| parents | a5229237eb50 |
| children | 3e2b7965ada9 |
| 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 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
16 |
|
45468
1d84bf5f9478
Patch #2167 from calvin: Remove unused imports
Christian Heimes <christian@cheimes.de>
parents:
33965
diff
changeset
|
17 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
|
18 from distutils.errors import \ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
19 DistutilsExecError, DistutilsPlatformError, \ |
| 19116 | 20 CompileError, LibError, LinkError, UnknownFileError |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
21 from distutils.ccompiler import \ |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
22 CCompiler, gen_preprocess_options, gen_lib_options |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
23 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
|
24 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
|
25 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
|
26 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
27 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
|
28 """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
|
29 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
|
30 """ |
|
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 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
|
33 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
34 # 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
|
35 # 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
|
36 # 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
|
37 # 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
|
38 # 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
|
39 executables = {} |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
40 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
41 # 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
|
42 _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
|
43 _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
|
44 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
45 # 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
|
46 # 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
54 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 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
|
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 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
|
61 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
62 # 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
|
63 # 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
|
64 # 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
|
65 |
|
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.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
|
67 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
|
68 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
|
69 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
70 self.preprocess_options = None |
| 13951 | 71 self.compile_options = ['/tWM', '/O2', '/q', '/g0'] |
| 72 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
|
73 |
|
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_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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
80 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
81 # -- 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
|
82 |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
83 def compile(self, sources, |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
84 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
|
85 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
|
86 |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
87 macros, objects, extra_postargs, pp_opts, build = \ |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
88 self._setup_compile(output_dir, macros, include_dirs, sources, |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 else: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
95 compile_opts.extend (self.compile_options) |
| 21267 | 96 |
|
31129
be9ef9b92d61
Compile the files in the same order they are passed to the compiler.
Thomas Heller <theller@ctypes.org>
parents:
26285
diff
changeset
|
97 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
|
98 try: |
|
be9ef9b92d61
Compile the files in the same order they are passed to the compiler.
Thomas Heller <theller@ctypes.org>
parents:
26285
diff
changeset
|
99 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
|
100 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
|
101 continue |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
102 # XXX why do the normpath here? |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
103 src = os.path.normpath(src) |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
104 obj = os.path.normpath(obj) |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
105 # 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
|
106 # Is it possible to skip the normpath? |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
107 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
|
108 |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
109 if ext == '.res': |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
110 # This is already a binary file -- skip it. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
111 continue # the 'for' loop |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
112 if ext == '.rc': |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
113 # 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
|
114 try: |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
115 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
|
116 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
|
117 raise CompileError, msg |
|
23823
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
118 continue # the 'for' loop |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
119 |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
120 # The next two are both for the real compiler. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
121 if ext in self._c_extensions: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
122 input_opt = "" |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
123 elif ext in self._cpp_extensions: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
124 input_opt = "-P" |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
125 else: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
126 # Unknown file type -- no extra options. The compiler |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
127 # 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
|
128 # file the compiler recognizes even if we don't. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
129 input_opt = "" |
|
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 output_opt = "-o" + obj |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
132 |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
133 # Compiler command line syntax is: "bcc32 [options] file(s)". |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
134 # 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
|
135 # the command line. |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
136 try: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
137 self.spawn ([self.cc] + compile_opts + pp_opts + |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
138 [input_opt, output_opt] + |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
139 extra_postargs + [src]) |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
140 except DistutilsExecError, msg: |
|
c48bf5df614a
Refactor compile() method implementations.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23668
diff
changeset
|
141 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
|
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 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
|
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 # compile () |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
146 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
147 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
148 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
|
149 objects, |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
150 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
|
151 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
|
152 debug=0, |
|
26036
771b6f521b95
This patch fixes the following bugs:
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
23823
diff
changeset
|
153 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
|
154 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
155 (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
|
156 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
|
157 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
|
158 |
|
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 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
|
160 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
|
161 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
|
162 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
|
163 try: |
| 21267 | 164 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
|
165 except DistutilsExecError, msg: |
| 21267 | 166 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
|
167 else: |
|
23668
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
168 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
|
169 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
170 # create_static_lib () |
| 21267 | 171 |
| 172 | |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
173 def link (self, |
| 21267 | 174 target_desc, |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
175 objects, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
176 output_filename, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
177 output_dir=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
178 libraries=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
179 library_dirs=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
180 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
|
181 export_symbols=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
182 debug=0, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
183 extra_preargs=None, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
184 extra_postargs=None, |
|
26036
771b6f521b95
This patch fixes the following bugs:
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
23823
diff
changeset
|
185 build_temp=None, |
|
771b6f521b95
This patch fixes the following bugs:
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
23823
diff
changeset
|
186 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
|
187 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
188 # 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
|
189 # msvccompiler.py |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
190 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
191 (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
|
192 (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
|
193 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
|
194 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
195 if runtime_library_dirs: |
|
23668
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
196 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
|
197 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
|
198 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
199 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
|
200 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
|
201 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
202 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
|
203 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
204 # 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
|
205 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
|
206 startup_obj = 'c0w32' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
207 if debug: |
|
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_debug[:] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
209 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
210 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
|
211 else: |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
212 startup_obj = 'c0d32' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
213 if debug: |
|
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_debug[:] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
215 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
216 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
|
217 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
218 |
| 14323 | 219 # 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
|
220 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
|
221 def_file = '' |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
222 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 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
|
227 contents = ['EXPORTS'] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
228 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
|
229 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
|
230 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
|
231 "writing %s" % def_file) |
| 14323 | 232 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
233 # 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
|
234 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
|
235 # 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
|
236 # 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
|
237 objects = [startup_obj] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
238 resources = [] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
239 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
|
240 (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
|
241 if ext == '.res': |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
242 resources.append(file) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
243 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
244 objects.append(file) |
| 21267 | 245 |
| 246 | |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
247 for l in library_dirs: |
| 21267 | 248 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
|
249 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
|
250 |
| 21267 | 251 # list of object files |
| 252 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
|
253 |
|
13953
7445d99da8dd
Added a whinging comment about the ugliness of constructing the BCPP
Greg Ward <gward@python.net>
parents:
13951
diff
changeset
|
254 # 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
|
255 # 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
|
256 # 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
|
257 # 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
|
258 # '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
|
259 # 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
|
260 # 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
|
261 # 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
|
262 # 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
|
263 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
264 # 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
|
265 ld_args.extend([',',output_filename]) |
| 21267 | 266 # no map file and start libraries |
| 13951 | 267 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
|
268 |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
269 for lib in libraries: |
| 21267 | 270 # 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
|
271 # (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
|
272 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
|
273 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
|
274 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
|
275 # 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
|
276 else: |
|
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
277 # 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
|
278 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
|
279 |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
280 # some default libraries |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
281 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
|
282 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
|
283 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
284 # 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
|
285 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
|
286 # add resource files |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
287 ld_args.append(',') |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
288 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
|
289 |
| 21267 | 290 |
|
13043
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_preargs: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
292 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
|
293 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
|
294 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
|
295 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
296 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
|
297 try: |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
298 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
|
299 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
|
300 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
|
301 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
302 else: |
|
23668
ca87119255eb
Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
21267
diff
changeset
|
303 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
|
304 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
305 # 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
|
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 # -- 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
|
308 |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
309 |
|
13802
b1a7f61ab781
Patch from Rene Liebscher. Some ugly changes, but supposedly this makes
Greg Ward <gward@python.net>
parents:
13043
diff
changeset
|
310 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
|
311 # 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
|
312 # 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
|
313 # 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
|
314 # |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
315 # 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
|
316 # 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
|
317 # ;-). 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
|
318 # 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
|
319 # 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
|
320 if debug: |
|
fc873ca0c7d3
Rewrote 'find_library_file()' much more cleanly (and consistently with
Greg Ward <gward@python.net>
parents:
13802
diff
changeset
|
321 dlib = (lib + "_d") |
| 14323 | 322 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
|
323 else: |
| 14323 | 324 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
|
325 |
|
13043
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
326 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
|
327 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
|
328 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
|
329 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
|
330 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
|
331 else: |
|
7df7452d13cd
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
332 # 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
|
333 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
|
334 |
|
14890
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
335 # 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
|
336 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
|
337 source_filenames, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
338 strip_dir=0, |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
339 output_dir=''): |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
340 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
|
341 obj_names = [] |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
342 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
|
343 # 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
|
344 (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
|
345 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
|
346 raise UnknownFileError, \ |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
347 "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
|
348 (ext, src_name) |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
349 if strip_dir: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
350 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
|
351 if ext == '.res': |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
352 # 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
|
353 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
|
354 elif ext == '.rc': |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
355 # 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
|
356 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
|
357 else: |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
358 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
|
359 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
|
360 return obj_names |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
361 |
|
afd7ece37c46
Big patch from Rene Liebscher to simplify the CCompiler API and
Greg Ward <gward@python.net>
parents:
14323
diff
changeset
|
362 # object_filenames () |
|
19318
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
363 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
364 def preprocess (self, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
365 source, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
366 output_file=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
367 macros=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
368 include_dirs=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
369 extra_preargs=None, |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
370 extra_postargs=None): |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
371 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
372 (_, macros, include_dirs) = \ |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 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
|
377 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
|
378 if extra_preargs: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
379 pp_args[:0] = extra_preargs |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
380 if extra_postargs: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
381 pp_args.extend(extra_postargs) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
382 pp_args.append(source) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
383 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
384 # 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
|
385 # 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
|
386 # exist). |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
387 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
|
388 if output_file: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
389 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
|
390 try: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
391 self.spawn(pp_args) |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
392 except DistutilsExecError, msg: |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
393 print msg |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
394 raise CompileError, msg |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
395 |
|
cbaa545c788d
[Patch #441691] preprocess() method for Borland C compiler.
Andrew M. Kuchling <amk@amk.ca>
parents:
19116
diff
changeset
|
396 # preprocess() |
