summaryrefslogtreecommitdiff
path: root/numpy/distutils/misc_util.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-12-12 12:31:11 -0500
committerGitHub <noreply@github.com>2016-12-12 12:31:11 -0500
commit78b06bdc2f463852dd59ec8ceea79a8290a6297f (patch)
treef94d253b5a8075be9c8d2832d73567f8ad8751f0 /numpy/distutils/misc_util.py
parentf55516951b77baa475a3e712f5f7cb831fb90c0a (diff)
parent21eeac2ebffd88461ae95e9d0dd487b12fab993e (diff)
downloadnumpy-78b06bdc2f463852dd59ec8ceea79a8290a6297f.tar.gz
Merge pull request #8355 from rolk/8355_mingw_py35
Fix building extensions with MinGW for Python 3.5
Diffstat (limited to 'numpy/distutils/misc_util.py')
-rw-r--r--numpy/distutils/misc_util.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 047282b84..b4b0aaf29 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -391,21 +391,36 @@ def mingw32():
return True
return False
-def msvc_runtime_library():
- "Return name of MSVC runtime library if Python was built with MSVC >= 7"
+def msvc_runtime_version():
+ "Return version of MSVC runtime library, as defined by __MSC_VER__ macro"
msc_pos = sys.version.find('MSC v.')
if msc_pos != -1:
- msc_ver = sys.version[msc_pos+6:msc_pos+10]
- lib = {'1300': 'msvcr70', # MSVC 7.0
- '1310': 'msvcr71', # MSVC 7.1
- '1400': 'msvcr80', # MSVC 8
- '1500': 'msvcr90', # MSVC 9 (VS 2008)
- '1600': 'msvcr100', # MSVC 10 (aka 2010)
- }.get(msc_ver, None)
+ msc_ver = int(sys.version[msc_pos+6:msc_pos+10])
else:
- lib = None
- return lib
+ msc_ver = None
+ return msc_ver
+def msvc_runtime_library():
+ "Return name of MSVC runtime library if Python was built with MSVC >= 7"
+ ver = msvc_runtime_major ()
+ if ver:
+ if ver < 140:
+ return "msvcr%i" % ver
+ else:
+ return "vcruntime%i" % ver
+ else:
+ return None
+
+def msvc_runtime_major():
+ "Return major version of MSVC runtime coded like get_build_msvc_version"
+ major = {1300: 70, # MSVC 7.0
+ 1310: 71, # MSVC 7.1
+ 1400: 80, # MSVC 8
+ 1500: 90, # MSVC 9 (aka 2008)
+ 1600: 100, # MSVC 10 (aka 2010)
+ 1900: 140, # MSVC 14 (aka 2015)
+ }.get(msvc_runtime_version(), None)
+ return major
#########################