summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-11-14 16:51:51 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-11-14 16:51:51 +0000
commit974b3909cebd8c3347090cc3783700448bf9c0b9 (patch)
treeba09690cc9ff5f2390c28bc0a4824f571ac1fecc
parent0ba62e66aef44d52f228c351366c4c021fd7a0fb (diff)
downloadnumpy-974b3909cebd8c3347090cc3783700448bf9c0b9.tar.gz
Generate config header for random kit (empty for now).
-rw-r--r--numpy/random/mtrand/randomkit.c1
-rw-r--r--numpy/random/setup.py21
2 files changed, 20 insertions, 2 deletions
diff --git a/numpy/random/mtrand/randomkit.c b/numpy/random/mtrand/randomkit.c
index 56f52c0b4..6103d88ed 100644
--- a/numpy/random/mtrand/randomkit.c
+++ b/numpy/random/mtrand/randomkit.c
@@ -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>
diff --git a/numpy/random/setup.py b/numpy/random/setup.py
index e7955db7f..e1ddbe4c8 100644
--- a/numpy/random/setup.py
+++ b/numpy/random/setup.py
@@ -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 @@ def configuration(parent_package='',top_path=None):
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'),