[Numpy-svn] r6028 - in trunk/numpy/random: . mtrand
numpy-svn at scipy.org
numpy-svn at scipy.org
Fri Nov 14 11:52:05 EST 2008
Author: cdavid
Date: 2008-11-14 10:51:51 -0600 (Fri, 14 Nov 2008)
New Revision: 6028
Modified:
trunk/numpy/random/mtrand/randomkit.c
trunk/numpy/random/setup.py
Log:
Generate config header for random kit (empty for now).
Modified: trunk/numpy/random/mtrand/randomkit.c
===================================================================
--- trunk/numpy/random/mtrand/randomkit.c 2008-11-14 16:10:21 UTC (rev 6027)
+++ trunk/numpy/random/mtrand/randomkit.c 2008-11-14 16:51:51 UTC (rev 6028)
@@ -64,6 +64,7 @@
/* 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>
Modified: trunk/numpy/random/setup.py
===================================================================
--- trunk/numpy/random/setup.py 2008-11-14 16:10:21 UTC (rev 6027)
+++ trunk/numpy/random/setup.py 2008-11-14 16:51:51 UTC (rev 6028)
@@ -1,5 +1,7 @@
-from os.path import join, split
+from os.path import join, split, dirname
+import os
import sys
+from distutils.dep_util import newer
def msvc_version():
"""Return the msvc version used to build the running python, None if not
@@ -22,12 +24,27 @@
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)
+
+ 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],
+ 'distributions.c']]+[generate_libraries]
+ + [generate_config_h],
libraries=libs,
depends = [join('mtrand','*.h'),
join('mtrand','*.pyx'),
More information about the Numpy-svn
mailing list