From e5f17e234a6ab931b767f15f66cb800721f13d41 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 10 Mar 2009 18:13:13 +0100 Subject: [PATCH] set up numpy include directories in test runner when running test scripts (by Lisandro) --- runtests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/runtests.py b/runtests.py index 8e8925e1..d6919440 100644 --- a/runtests.py +++ b/runtests.py @@ -18,6 +18,15 @@ EXT_DEP_MODULES = { '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 = { # such as: # (2,4) : lambda x: x in ['run.set'] @@ -271,9 +280,14 @@ class CythonCompileTestCase(unittest.TestCase): if incdir: build_extension.include_dirs.append(incdir) 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( module, sources = [self.build_target_filename(module)], + include_dirs = ext_include_dirs, extra_compile_args = CFLAGS, ) if self.language == 'cpp': -- 2.26.2