diff options
author | David Cournapeau <cournape@gmail.com> | 2008-11-14 16:51:51 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-11-14 16:51:51 +0000 |
commit | 974b3909cebd8c3347090cc3783700448bf9c0b9 (patch) | |
tree | ba09690cc9ff5f2390c28bc0a4824f571ac1fecc /numpy/random/setup.py | |
parent | 0ba62e66aef44d52f228c351366c4c021fd7a0fb (diff) | |
download | numpy-974b3909cebd8c3347090cc3783700448bf9c0b9.tar.gz |
Generate config header for random kit (empty for now).
Diffstat (limited to 'numpy/random/setup.py')
-rw-r--r-- | numpy/random/setup.py | 21 |
1 files changed, 19 insertions, 2 deletions
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'), |