[Numpy-svn] r6030 - trunk/numpy/random

numpy-svn@scip... numpy-svn@scip...
Fri Nov 14 10:52:49 CST 2008


Author: cdavid
Date: 2008-11-14 10:52:41 -0600 (Fri, 14 Nov 2008)
New Revision: 6030

Modified:
   trunk/numpy/random/setup.py
Log:
Add a macro to know whether we need the mingw workaround for _ftime + add a define for the MSVCR version.

Modified: trunk/numpy/random/setup.py
===================================================================
--- trunk/numpy/random/setup.py	2008-11-14 16:52:18 UTC (rev 6029)
+++ trunk/numpy/random/setup.py	2008-11-14 16:52:41 UTC (rev 6030)
@@ -2,6 +2,7 @@
 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 @@
         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 @@
         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:



More information about the Numpy-svn mailing list