diff options
Diffstat (limited to 'numpy/random/setup.py')
-rw-r--r-- | numpy/random/setup.py | 37 |
1 files changed, 12 insertions, 25 deletions
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'))) |