summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-11-17 13:53:05 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-11-17 13:53:05 +0000
commit13b3ffbd8a844168d95af92271291dc9a3888153 (patch)
treef8a2a11487edfdc966d16a652ff5d1a21664bef5 /numpy
parent24db8a1d532d8eb9ed2ebbd5cf5e393be7a9a11c (diff)
downloadnumpy-13b3ffbd8a844168d95af92271291dc9a3888153.tar.gz
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.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/mtrand/randomkit.c2
-rw-r--r--numpy/random/setup.py37
2 files changed, 12 insertions, 27 deletions
diff --git a/numpy/random/mtrand/randomkit.c b/numpy/random/mtrand/randomkit.c
index d90f38af6..23ea4b738 100644
--- a/numpy/random/mtrand/randomkit.c
+++ b/numpy/random/mtrand/randomkit.c
@@ -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>
diff --git a/numpy/random/setup.py b/numpy/random/setup.py
index d1d867acf..6ee6efd6b 100644
--- a/numpy/random/setup.py
+++ b/numpy/random/setup.py
@@ -6,11 +6,12 @@ from distutils.msvccompiler import get_build_version as get_msvc_build_version
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 @@ 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)
-
- 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()
+ defs = []
+ if needs_mingw_ftime_workaround():
+ defs.append(("NPY_NEEDS_MINGW_TIME_WORKAROUND", None))
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')))