diff options
author | David Cournapeau <cournape@gmail.com> | 2008-11-14 16:52:41 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-11-14 16:52:41 +0000 |
commit | 1640efdadc8d4686adca70efe6a39b2e48b0293b (patch) | |
tree | 24360e0e53140320dbef714cc3578305b0735126 /numpy/random/setup.py | |
parent | a27c31aad71fd2e7f23f0a3bded0c243d0ead7ad (diff) | |
download | numpy-1640efdadc8d4686adca70efe6a39b2e48b0293b.tar.gz |
Add a macro to know whether we need the mingw workaround for _ftime + add a define for the MSVCR version.
Diffstat (limited to 'numpy/random/setup.py')
-rw-r--r-- | numpy/random/setup.py | 17 |
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: |