mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Catch up with changes in 'gen_lib_options()':
- change how we call it - added methods 'library_dir_option()', 'library_option()', and 'find_library_file()' that it calls Added 'force' flag; it's automatically "respected", because this class always rebuilds everything! (Which it to say, "force=0" is not respected.)
This commit is contained in:
parent
4fecfce4d0
commit
c74138d941
1 changed files with 30 additions and 5 deletions
|
@ -23,9 +23,10 @@ class MSVCCompiler (CCompiler) :
|
||||||
|
|
||||||
def __init__ (self,
|
def __init__ (self,
|
||||||
verbose=0,
|
verbose=0,
|
||||||
dry_run=0):
|
dry_run=0,
|
||||||
|
force=0):
|
||||||
|
|
||||||
CCompiler.__init__ (self, verbose, dry_run)
|
CCompiler.__init__ (self, verbose, dry_run, force)
|
||||||
|
|
||||||
# XXX This is a nasty dependency to add on something otherwise
|
# XXX This is a nasty dependency to add on something otherwise
|
||||||
# pretty clean. move it to build_ext under an nt specific part.
|
# pretty clean. move it to build_ext under an nt specific part.
|
||||||
|
@ -164,9 +165,9 @@ class MSVCCompiler (CCompiler) :
|
||||||
if library_dirs is None:
|
if library_dirs is None:
|
||||||
library_dirs = []
|
library_dirs = []
|
||||||
|
|
||||||
lib_opts = gen_lib_options (self.library_dirs + library_dirs,
|
lib_opts = gen_lib_options (self,
|
||||||
self.libraries + libraries,
|
self.library_dirs + library_dirs,
|
||||||
"/LIBPATH:%s", "%s.lib")
|
self.libraries + libraries)
|
||||||
|
|
||||||
ld_args = self.ldflags_shared + lib_opts + \
|
ld_args = self.ldflags_shared + lib_opts + \
|
||||||
objects + ['/OUT:' + output_filename]
|
objects + ['/OUT:' + output_filename]
|
||||||
|
@ -200,6 +201,9 @@ class MSVCCompiler (CCompiler) :
|
||||||
specified source filename."""
|
specified source filename."""
|
||||||
return self._change_extensions( source_filenames, self._shared_lib_ext )
|
return self._change_extensions( source_filenames, self._shared_lib_ext )
|
||||||
|
|
||||||
|
# XXX ummm... these aren't right, are they? I thought library 'foo' on
|
||||||
|
# DOS/Windows was to be found in "foo.lib", not "libfoo.lib"!
|
||||||
|
|
||||||
def library_filename (self, libname):
|
def library_filename (self, libname):
|
||||||
"""Return the static library filename corresponding to the
|
"""Return the static library filename corresponding to the
|
||||||
specified library name."""
|
specified library name."""
|
||||||
|
@ -210,4 +214,25 @@ class MSVCCompiler (CCompiler) :
|
||||||
specified library name."""
|
specified library name."""
|
||||||
return "lib%s%s" %( libname, self._shared_lib_ext )
|
return "lib%s%s" %( libname, self._shared_lib_ext )
|
||||||
|
|
||||||
|
|
||||||
|
def library_dir_option (self, dir):
|
||||||
|
return "/LIBPATH:" + dir
|
||||||
|
|
||||||
|
def library_option (self, lib):
|
||||||
|
return self.library_filename (lib)
|
||||||
|
|
||||||
|
|
||||||
|
def find_library_file (self, dirs, lib):
|
||||||
|
|
||||||
|
for dir in dirs:
|
||||||
|
libfile = os.path.join (dir, self.library_filename (lib))
|
||||||
|
if os.path.exists (libfile):
|
||||||
|
return libfile
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Oops, didn't find it in *any* of 'dirs'
|
||||||
|
return None
|
||||||
|
|
||||||
|
# find_library_file ()
|
||||||
|
|
||||||
# class MSVCCompiler
|
# class MSVCCompiler
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue