Commit e5f17e23 authored by Stefan Behnel's avatar Stefan Behnel

set up numpy include directories in test runner when running test scripts (by Lisandro)

parent a28d90b5
...@@ -18,6 +18,15 @@ EXT_DEP_MODULES = { ...@@ -18,6 +18,15 @@ EXT_DEP_MODULES = {
'numpy' : re.compile('.*\.numpy_.*').match 'numpy' : re.compile('.*\.numpy_.*').match
} }
def get_numpy_include_dirs():
import numpy
return [numpy.get_include()]
EXT_DEP_INCLUDES = [
# test name matcher , callable returning list
(re.compile('numpy_.*').match, get_numpy_include_dirs),
]
VER_DEP_MODULES = { VER_DEP_MODULES = {
# such as: # such as:
# (2,4) : lambda x: x in ['run.set'] # (2,4) : lambda x: x in ['run.set']
...@@ -271,9 +280,14 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -271,9 +280,14 @@ class CythonCompileTestCase(unittest.TestCase):
if incdir: if incdir:
build_extension.include_dirs.append(incdir) build_extension.include_dirs.append(incdir)
build_extension.finalize_options() build_extension.finalize_options()
ext_include_dirs = []
for match, get_additional_include_dirs in EXT_DEP_INCLUDES:
if match(module):
ext_include_dirs += get_additional_include_dirs()
extension = Extension( extension = Extension(
module, module,
sources = [self.build_target_filename(module)], sources = [self.build_target_filename(module)],
include_dirs = ext_include_dirs,
extra_compile_args = CFLAGS, extra_compile_args = CFLAGS,
) )
if self.language == 'cpp': if self.language == 'cpp':
......
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