summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/msvccompiler.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-04-19 02:16:49 (GMT)
committerGreg Ward <gward@python.net>2000-04-19 02:16:49 (GMT)
commitf70c6031495f885839f077f06858b33cd0c04d2b (patch)
tree944436cf08340e45711e3722d598768d2caf3aab /Lib/distutils/msvccompiler.py
parent316778860faa417db231dafa7116ca3b2c71d641 (diff)
downloadcpython-f70c6031495f885839f077f06858b33cd0c04d2b.zip
cpython-f70c6031495f885839f077f06858b33cd0c04d2b.tar.gz
cpython-f70c6031495f885839f077f06858b33cd0c04d2b.tar.bz2
Added 'link_executable()' method (Berthold Hoellmann).
Two small fixes to 'link_shared_object()'.
Diffstat (limited to 'Lib/distutils/msvccompiler.py')
-rw-r--r--Lib/distutils/msvccompiler.py51
1 files changed, 48 insertions, 3 deletions
diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py
index c7a69c3..3667afc 100644
--- a/Lib/distutils/msvccompiler.py
+++ b/Lib/distutils/msvccompiler.py
@@ -333,15 +333,13 @@ class MSVCCompiler (CCompiler) :
(libraries, library_dirs, runtime_library_dirs) = \
self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
- if self.runtime_library_dirs:
+ if runtime_library_dirs:
self.warn ("I don't know what to do with 'runtime_library_dirs': "
+ str (runtime_library_dirs))
lib_opts = gen_lib_options (self,
library_dirs, runtime_library_dirs,
libraries)
- if type (output_dir) not in (StringType, NoneType):
- raise TypeError, "'output_dir' must be a string or None"
if output_dir is not None:
output_filename = os.path.join (output_dir, output_filename)
@@ -370,6 +368,53 @@ class MSVCCompiler (CCompiler) :
self.announce ("skipping %s (up-to-date)" % output_filename)
# link_shared_object ()
+
+
+ def link_executable (self,
+ objects,
+ output_progname,
+ output_dir=None,
+ libraries=None,
+ library_dirs=None,
+ runtime_library_dirs=None,
+ debug=0,
+ extra_preargs=None,
+ extra_postargs=None):
+
+ (objects, output_dir) = self._fix_object_args (objects, output_dir)
+ (libraries, library_dirs, runtime_library_dirs) = \
+ self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
+
+ if runtime_library_dirs:
+ self.warn ("I don't know what to do with 'runtime_library_dirs': "
+ + str (runtime_library_dirs))
+
+ lib_opts = gen_lib_options (self,
+ library_dirs, runtime_library_dirs,
+ libraries)
+ output_filename = output_progname + self.exe_extension
+ if output_dir is not None:
+ output_filename = os.path.join (output_dir, output_filename)
+
+ if self._need_link (objects, output_filename):
+
+ if debug:
+ ldflags = self.ldflags_shared_debug[1:]
+ else:
+ ldflags = self.ldflags_shared[1:]
+
+ ld_args = ldflags + lib_opts + \
+ objects + ['/OUT:' + output_filename]
+
+ if extra_preargs:
+ ld_args[:0] = extra_preargs
+ if extra_postargs:
+ ld_args.extend (extra_postargs)
+
+ self.mkpath (os.path.dirname (output_filename))
+ self.spawn ([self.link] + ld_args)
+ else:
+ self.announce ("skipping %s (up-to-date)" % output_filename)
# -- Miscellaneous methods -----------------------------------------