diff options
author | Roland Kaufmann <rka081+numpy@uib.no> | 2017-02-22 13:17:24 +0100 |
---|---|---|
committer | Roland Kaufmann <rka081+numpy@uib.no> | 2017-02-23 10:05:58 +0100 |
commit | d16e4f1cc51a61b1eca657a9c17fe847f7d36479 (patch) | |
tree | 257902c7da31d12e100ae025b7fed8b587b5eee3 | |
parent | f228d75bfa4d4f3964dfc6cbfbbf982e95ce94ab (diff) | |
download | numpy-d16e4f1cc51a61b1eca657a9c17fe847f7d36479.tar.gz |
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.
-rw-r--r-- | numpy/distutils/mingw32ccompiler.py | 15 |
1 files changed, 12 insertions, 3 deletions
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' |