summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorRobert Kern <robert.kern@gmail.com>2008-07-19 01:12:16 +0000
committerRobert Kern <robert.kern@gmail.com>2008-07-19 01:12:16 +0000
commitc003f55e3068e99b174a3407aab0499662cdbfb2 (patch)
tree1d185f464f4db8e3286aa0f772e8666af8d87dd6 /numpy
parentf3bef65f681d7a845a699071a0b11f3e5d68fea5 (diff)
downloadnumpy-c003f55e3068e99b174a3407aab0499662cdbfb2.tar.gz
Generate headers in the right place for inplace builds.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/setup.py17
-rw-r--r--numpy/distutils/misc_util.py17
-rw-r--r--numpy/random/setup.py6
3 files changed, 28 insertions, 12 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index 15af7e0c5..f33322f4b 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -65,7 +65,10 @@ def configuration(parent_package='',top_path=None):
header_dir = 'include/numpy' # this is relative to config.path_in_package
def generate_config_h(ext, build_dir):
- target = join(build_dir,'config.h')
+ target = join(build_dir,header_dir,'config.h')
+ dir = os.path.dirname(target)
+ if not os.path.exists(dir):
+ os.makedirs(dir)
if newer(__file__,target):
config_cmd = config.get_config_cmd()
log.info('Generating %s',target)
@@ -159,7 +162,10 @@ def configuration(parent_package='',top_path=None):
def generate_numpyconfig_h(ext, build_dir):
"""Depends on config.h: generate_config_h has to be called before !"""
- target = join(build_dir,'numpyconfig.h')
+ target = join(build_dir,header_dir,'numpyconfig.h')
+ dir = os.path.dirname(target)
+ if not os.path.exists(dir):
+ os.makedirs(dir)
if newer(__file__,target):
config_cmd = config.get_config_cmd()
log.info('Generating %s',target)
@@ -198,7 +204,7 @@ def configuration(parent_package='',top_path=None):
try:
m = __import__(module_name)
log.info('executing %s', script)
- h_file, c_file, doc_file = m.generate_api(build_dir)
+ h_file, c_file, doc_file = m.generate_api(os.path.join(build_dir, header_dir))
finally:
del sys.path[0]
config.add_data_files((header_dir, h_file),
@@ -210,7 +216,10 @@ def configuration(parent_package='',top_path=None):
generate_ufunc_api = generate_api_func('generate_ufunc_api')
def generate_umath_c(ext,build_dir):
- target = join(build_dir,'__umath_generated.c')
+ target = join(build_dir,header_dir,'__umath_generated.c')
+ dir = os.path.dirname(target)
+ if not os.path.exists(dir):
+ os.makedirs(dir)
script = generate_umath_py
if newer(script,target):
f = open(target,'w')
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 30a5014aa..96311b311 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -114,9 +114,20 @@ def njoin(*path):
def get_mathlibs(path=None):
"""Return the MATHLIB line from numpyconfig.h
"""
- if path is None:
- path = os.path.join(get_numpy_include_dirs()[0], 'numpy')
- config_file = os.path.join(path,'numpyconfig.h')
+ if path is not None:
+ config_file = os.path.join(path,'numpyconfig.h')
+ else:
+ # Look for the file in each of the numpy include directories.
+ dirs = get_numpy_include_dirs()
+ for path in dirs:
+ fn = os.path.join(path,'numpyconfig.h')
+ if os.path.exists(fn):
+ config_file = fn
+ break
+ else:
+ raise DistutilsError('numpyconfig.h not found in numpy include '
+ 'dirs %r' % (dirs,))
+
fid = open(config_file)
mathlibs = []
s = '#define MATHLIB'
diff --git a/numpy/random/setup.py b/numpy/random/setup.py
index 104a7986a..6ec65ee19 100644
--- a/numpy/random/setup.py
+++ b/numpy/random/setup.py
@@ -6,11 +6,7 @@ def configuration(parent_package='',top_path=None):
def generate_libraries(ext, build_dir):
config_cmd = config.get_config_cmd()
- if top_path is None:
- libs = get_mathlibs()
- else:
- path = join(split(build_dir)[0],'core')
- libs = get_mathlibs(path)
+ libs = get_mathlibs()
tc = testcode_wincrypt()
if config_cmd.try_run(tc):
libs.append('Advapi32')