diff options
author | David Cournapeau <cournape@gmail.com> | 2008-06-12 09:48:42 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-06-12 09:48:42 +0000 |
commit | d039ec97e0fbfee068e90ae800681aac0c959f27 (patch) | |
tree | 6cf8a1254a634c8c9147cbd660254b7fcc5ffe15 | |
parent | a7eb6e985662108fcf6cd27b0808e26d65a33e4f (diff) | |
download | numpy-d039ec97e0fbfee068e90ae800681aac0c959f27.tar.gz |
Set numpy include path relatively to top setup callee when bootstrapping.
-rw-r--r-- | numpy/distutils/command/scons.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/numpy/distutils/command/scons.py b/numpy/distutils/command/scons.py index 4bf556a0d..72a3a46e4 100644 --- a/numpy/distutils/command/scons.py +++ b/numpy/distutils/command/scons.py @@ -10,7 +10,6 @@ from numpy.distutils.ccompiler import CCompiler from numpy.distutils.fcompiler import FCompiler from numpy.distutils.exec_command import find_executable from numpy.distutils import log -from numpy.distutils.misc_util import get_numpy_include_dirs def get_scons_build_dir(): """Return the top path where everything produced by scons will be put. @@ -57,6 +56,21 @@ def get_python_exec_invoc(): import sys return sys.executable +def get_numpy_include_dirs(sconscript_path): + """Return include dirs for numpy. + + The paths are relatively to the setup.py script path.""" + from numpy.distutils.misc_util import get_numpy_include_dirs as _incdir + from numscons import get_scons_build_dir + scdir = pjoin(get_scons_build_dir(), pdirname(sconscript_path)) + n = scdir.count(os.sep) + + dirs = _incdir() + rdirs = [] + for d in dirs: + rdirs.append(pjoin(os.sep.join([os.pardir for i in range(n+1)]), d)) + return rdirs + def dirl_to_str(dirlist): """Given a list of directories, returns a string where the paths are concatenated by the path separator. @@ -387,7 +401,7 @@ class scons(old_build_ext): cmd.append('cxx_opt=%s' % dist2sconscxx(self.cxxcompiler)) cmd.append('cxx_opt_path=%s' % protect_path(get_cxx_tool_path(self.cxxcompiler))) - cmd.append('include_bootstrap=%s' % dirl_to_str(get_numpy_include_dirs())) + cmd.append('include_bootstrap=%s' % dirl_to_str(get_numpy_include_dirs(sconscript))) if self.silent: if int(self.silent) == 2: cmd.append('-Q') |