summaryrefslogtreecommitdiff
path: root/numpy/random/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random/setup.py')
-rw-r--r--numpy/random/setup.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/numpy/random/setup.py b/numpy/random/setup.py
index e1ddbe4c8..93766e0b8 100644
--- a/numpy/random/setup.py
+++ b/numpy/random/setup.py
@@ -2,6 +2,7 @@ from os.path import join, split, dirname
import os
import sys
from distutils.dep_util import newer
+from numpy.distutils.misc_util import msvc_runtime_library
def msvc_version():
"""Return the msvc version used to build the running python, None if not
@@ -11,6 +12,11 @@ def msvc_version():
return sys.version[msc_pos+6:msc_pos+10]
return None
+def msvcrt_to_hex(msvc):
+ major = msvc / 100
+ minor = msvc - major * 100
+ return hex(major * 256 + minor)
+
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration, get_mathlibs
config = Configuration('random',parent_package,top_path)
@@ -31,6 +37,17 @@ def configuration(parent_package='',top_path=None):
if not os.path.exists(dir):
os.makedirs(dir)
+ msv = msvc_version()
+ if msv and msv >= 1400:
+ msvcrt = msvc_runtime_library()
+ if msvcrt is None:
+ raise ValueError("Discrepancy between " \
+ "msvc_runtime_library " \
+ "and our msvc detection scheme ?"
+ hmsvc = msvc_to_hex(msvcrt)
+ defs.append("NPY_NEEDS_MINGW_TIME_WORKAROUND")
+ defs.append(("NPY_MSVCRT_VERSION", str(hmsvc)))
+
if newer(__file__, target):
target_f = open(target, 'a')
for d in defs: