From d16e4f1cc51a61b1eca657a9c17fe847f7d36479 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Wed, 22 Feb 2017 13:17:24 +0100 Subject: BUG: Skip custom library check if not MSVC runtime If Python has been built using a different runtime, for example using the GNU compiler in MSYS, the version string will of course not contain a reference to the MSVC runtime. Instead of attempting to build an import library for yet another runtime, we assume that the compiler used to build the extension is now the same as was used to build Python, and that it will pass the right runtime to the linker without any further command-line options. --- numpy/distutils/mingw32ccompiler.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'numpy') diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 65fd2cc82..870df0693 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -348,15 +348,24 @@ def build_msvcr_library(debug=False): if os.name != 'nt': return False - msvcr_name = msvc_runtime_library() + # If the version number is None, then we couldn't find the MSVC runtime at + # all, because we are running on a Python distribution which is customed + # compiled; trust that the compiler is the same as the one available to us + # now, and that it is capable of linking with the correct runtime without + # any extra options. + msvcr_ver = msvc_runtime_major() + if msvcr_ver is None: + log.debug('Skip building import library: ' + 'Runtime is not compiled with MSVC') + return False # Skip using a custom library for versions < MSVC 8.0 - msvcr_ver = msvc_runtime_major() - if msvcr_ver and msvcr_ver < 80: + if msvcr_ver < 80: log.debug('Skip building msvcr library:' ' custom functionality not present') return False + msvcr_name = msvc_runtime_library() if debug: msvcr_name += 'd' -- cgit v1.2.1