[Python-checkins] CVS: distutils/distutils msvccompiler.py,1.26,1.27
Greg Ward
python-dev@python.org
2000年4月18日 22:16:52 -0400 (EDT)
Update of /projects/cvsroot/distutils/distutils
In directory kaluha:/tmp/cvs-serv5819
Modified Files:
msvccompiler.py
Log Message:
Added 'link_executable()' method (Berthold Hoellmann).
Two small fixes to 'link_shared_object()'.
Index: msvccompiler.py
===================================================================
RCS file: /projects/cvsroot/distutils/distutils/msvccompiler.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** msvccompiler.py 2000年04月15日 22:15:07 1.26
--- msvccompiler.py 2000年04月19日 02:16:49 1.27
***************
*** 9,13 ****
# finding DevStudio (through the registry)
! __revision__ = "$Id: msvccompiler.py,v 1.26 2000年04月15日 22:15:07 gward Exp $"
import sys, os, string
--- 9,13 ----
# finding DevStudio (through the registry)
! __revision__ = "$Id: msvccompiler.py,v 1.27 2000年04月19日 02:16:49 gward Exp $"
import sys, os, string
***************
*** 334,338 ****
self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
! if self.runtime_library_dirs:
self.warn ("I don't know what to do with 'runtime_library_dirs': "
+ str (runtime_library_dirs))
--- 334,338 ----
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))
***************
*** 341,346 ****
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)
--- 341,344 ----
***************
*** 371,374 ****
--- 369,419 ----
# 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)