# -*- python -*- Import("env") import os import sys test_env = env.Clone() lib_path = os.path.abspath(os.path.join("..", "src")) test_env.AppendENVPath("PYTHONPATH", os.path.abspath(".")) test_env.AppendENVPath("LD_LIBRARY_PATH", lib_path) test_env.Append(LIBPATH=[lib_path]) test_env.Append(LIBS=["boost_numpy"]) test = [] def RunPythonUnitTest(target, source, env): if not env.Execute('%s %s' % (sys.executable, source[0].abspath)): env.Execute(Touch(target)) def PythonUnitTest(env, script, dependencies): run = env.Command(".%s.succeeded" % str(script), script, RunPythonUnitTest) env.Depends(run, dependencies) return run for name in ("ufunc", "templates", "ndarray", "indexing", "shapes"): mod = test_env.SharedLibrary("%s_mod" % name, "%s_mod.cpp" % name, SHLIBPREFIX="") test.extend(PythonUnitTest(test_env, "%s.py" % name, mod)) Return("test")