[Numpy-svn] r6073 - in trunk/numpy/random: . mtrand

numpy-svn@scip... numpy-svn@scip...
Mon Nov 17 07:53:15 CST 2008


Author: cdavid
Date: 2008-11-17 07:53:05 -0600 (Mon, 17 Nov 2008)
New Revision: 6073

Modified:
   trunk/numpy/random/mtrand/randomkit.c
   trunk/numpy/random/setup.py
Log:
Do not generate a config.h for randomkit: it does not work as it is, and adding per-subpackage include path is a PITA with distutils.

Modified: trunk/numpy/random/mtrand/randomkit.c
===================================================================
--- trunk/numpy/random/mtrand/randomkit.c	2008-11-17 13:52:47 UTC (rev 6072)
+++ trunk/numpy/random/mtrand/randomkit.c	2008-11-17 13:53:05 UTC (rev 6073)
@@ -64,8 +64,6 @@
 
 /* static char const rcsid[] =
   "@(#) $Jeannot: randomkit.c,v 1.28 2005/07/21 22:14:09 js Exp $"; */
-#include "config.h"
-
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>

Modified: trunk/numpy/random/setup.py
===================================================================
--- trunk/numpy/random/setup.py	2008-11-17 13:52:47 UTC (rev 6072)
+++ trunk/numpy/random/setup.py	2008-11-17 13:53:05 UTC (rev 6073)
@@ -6,11 +6,12 @@
 
 def needs_mingw_ftime_workaround(config):
     # We need the mingw workaround for _ftime if the msvc runtime version is
-    # 7.1 or above and we build with mingw
-    if config.compiler.compiler_type == 'mingw32':
-        msver = get_msvc_build_version()
-        if msver and msver > 7:
-            return True
+    # 7.1 or above and we build with mingw ...
+    # ... but we can't easily detect compiler version outside distutils command
+    # context, so we will need to detect in randomkit whether we build with gcc
+    msver = get_msvc_build_version()
+    if msver and msver > 7:
+        return True
 
     return False
 
@@ -27,36 +28,22 @@
         ext.libraries.extend(libs)
         return None
 
-    def generate_config_h(ext, build_dir):
-        defs = []
-        target = join(build_dir, "mtrand", 'config.h')
-        dir = dirname(target)
-        if not os.path.exists(dir):
-            os.makedirs(dir)
+    defs = []
+    if needs_mingw_ftime_workaround():
+        defs.append(("NPY_NEEDS_MINGW_TIME_WORKAROUND", None))
 
-        config_cmd = config.get_config_cmd()
-        if needs_mingw_ftime_workaround(config_cmd):
-            defs.append("NPY_NEEDS_MINGW_TIME_WORKAROUND")
-
-        if newer(__file__, target):
-            target_f = open(target, 'a')
-            for d in defs:
-                if isinstance(d, str):
-                    target_f.write('#define %s\n' % (d))
-            target_f.close()
-
     libs = []
     # Configure mtrand
     config.add_extension('mtrand',
                          sources=[join('mtrand', x) for x in
                                   ['mtrand.c', 'randomkit.c', 'initarray.c',
-                                   'distributions.c']]+[generate_libraries]
-                                   + [generate_config_h],
+                                   'distributions.c']]+[generate_libraries],
                          libraries=libs,
                          depends = [join('mtrand','*.h'),
                                     join('mtrand','*.pyx'),
                                     join('mtrand','*.pxi'),
-                                    ]
+                                    ],
+                         define_macros = defs,
                         )
 
     config.add_data_files(('.', join('mtrand', 'randomkit.h')))



More information about the Numpy-svn mailing list