diff -r 60b6e820abe5 Lib/distutils/ccompiler.py --- a/Lib/distutils/ccompiler.py Fri Oct 28 19:01:46 2016 -0400 +++ b/Lib/distutils/ccompiler.py Sat Oct 29 16:16:57 2016 +0900 @@ -67,6 +67,7 @@ static_lib_format = None # format string shared_lib_format = None # prob. same as static_lib_format exe_extension = None # string + lib_types = ["static", "shared"] # list of strings # Default language settings. language_map is used to detect a source # file or Extension target language, checking source filenames. @@ -842,6 +843,9 @@ # is one of the intended parameters to the format string) # * exe_extension - # extension for executable files, eg. '' or '.exe' + # * lib_types - + # list of library types for filename generation, + # eg. ['static', 'shared'] def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): if output_dir is None: @@ -875,9 +879,10 @@ def library_filename(self, libname, lib_type='static', # or 'shared' strip_dir=0, output_dir=''): assert output_dir is not None - if lib_type not in ("static", "shared", "dylib", "xcode_stub"): - raise ValueError( - "'lib_type' must be \"static\", \"shared\", \"dylib\", or \"xcode_stub\"") + if lib_type not in self.lib_types: + quote_types = ['"%s"' % t for t in self.lib_types] + raise ValueError("'lib_type' must be %s, or %s" % + (", ".join(quote_types[:-1]), quote_types[-1])) fmt = getattr(self, lib_type + "_lib_format") ext = getattr(self, lib_type + "_lib_extension") diff -r 60b6e820abe5 Lib/distutils/unixccompiler.py --- a/Lib/distutils/unixccompiler.py Fri Oct 28 19:01:46 2016 -0400 +++ b/Lib/distutils/unixccompiler.py Sat Oct 29 16:16:57 2016 +0900 @@ -77,10 +77,12 @@ shared_lib_extension = ".so" dylib_lib_extension = ".dylib" xcode_stub_lib_extension = ".tbd" + implib_lib_extension = ".dll.a" static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" - xcode_stub_lib_format = dylib_lib_format + implib_lib_format = xcode_stub_lib_format = dylib_lib_format if sys.platform == "cygwin": exe_extension = ".exe" + lib_types = ["static", "shared", "dylib", "xcode_stub", "implib"] def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): @@ -260,6 +262,7 @@ shared_f = self.library_filename(lib, lib_type='shared') dylib_f = self.library_filename(lib, lib_type='dylib') xcode_stub_f = self.library_filename(lib, lib_type='xcode_stub') + implib_f = self.library_filename(lib, lib_type='implib') static_f = self.library_filename(lib, lib_type='static') if sys.platform == 'darwin': @@ -288,13 +291,12 @@ else: sysroot = m.group(1) - - for dir in dirs: shared = os.path.join(dir, shared_f) dylib = os.path.join(dir, dylib_f) + xcode_stub = os.path.join(dir, xcode_stub_f) + implib = os.path.join(dir, implib_f) static = os.path.join(dir, static_f) - xcode_stub = os.path.join(dir, xcode_stub_f) if sys.platform == 'darwin' and ( dir.startswith('/System/') or ( @@ -302,8 +304,9 @@ shared = os.path.join(sysroot, dir[1:], shared_f) dylib = os.path.join(sysroot, dir[1:], dylib_f) + xcode_stub = os.path.join(sysroot, dir[1:], xcode_stub_f) + implib = os.path.join(sysroot, dir[1:], implib_f) static = os.path.join(sysroot, dir[1:], static_f) - xcode_stub = os.path.join(sysroot, dir[1:], xcode_stub_f) # We're second-guessing the linker here, with not much hard # data to go on: GCC seems to prefer the shared library, so I'm @@ -313,6 +316,8 @@ return dylib elif os.path.exists(xcode_stub): return xcode_stub + elif os.path.exists(implib): + return implib elif os.path.exists(shared): return shared elif os.path.exists(static):