Commit b9c2b0c2 authored by Bas Nijholt's avatar Bas Nijholt Committed by Joseph Weston
Browse files

add numpy includes later in the extension config

Previously, the numpy 'include_dirs' would be shadowed by
any 'include_dirs' provided in 'build.conf'. We want to avoid
burdening people with remembering to specify the numpy 'include_dirs'
every time, and if custom numpy headers is the desired behaviour, these
can still be specified in 'build.conf', and will take precedence.
parent 0f776c73
......@@ -505,6 +505,20 @@ def maybe_cythonize(exts):
return result
def maybe_add_numpy_include(exts):
# Add NumPy header path to include_dirs of all the extensions.
try:
import numpy
except ImportError:
print(banner(' Caution '), 'NumPy header directory cannot be determined'
' ("import numpy" failed).', banner(), sep='\n', file=sys.stderr)
else:
numpy_include = numpy.get_include()
for ext in exts.values():
ext.setdefault('include_dirs', []).append(numpy_include)
return exts
def main():
check_python_version((3, 5))
check_versions()
......@@ -540,17 +554,6 @@ def main():
dict(sources=['kwant/linalg/_mumps.pyx'],
depends=['kwant/linalg/cmumps.pxd']))])
# Add NumPy header path to include_dirs of all the extensions.
try:
import numpy
except ImportError:
print(banner(' Caution '), 'NumPy header directory cannot be determined'
' ("import numpy" failed).', banner(), sep='\n', file=sys.stderr)
else:
numpy_include = numpy.get_include()
for ext in exts.values():
ext.setdefault('include_dirs', []).append(numpy_include)
aliases = [('mumps', 'kwant.linalg._mumps')]
init_cython()
......@@ -559,6 +562,7 @@ def main():
build_summary = []
exts = configure_extensions(exts, aliases, build_summary)
exts = configure_special_extensions(exts, build_summary)
exts = maybe_add_numpy_include(exts)
exts = maybe_cythonize(exts)
classifiers = """\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment