-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathSConscript
More file actions
39 lines (31 loc) · 1.43 KB
/
Copy pathSConscript
File metadata and controls
39 lines (31 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- python -*-
# Copyright Jim Bosch 2010-2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
Import(['env', 'lib', 'EXT_SUFFIX', 'LIB_SUFFIX', 'OBJ_SUFFIX', 'PY_SUFFIX'])
import os
import sys
test_env = env.Clone()
lib_path = os.path.abspath(os.path.join("..", "src"))
test_env.Append(LIBPATH=[lib_path])
test_env.Append(RPATH=[lib_path])
test_env.Append(LINKFLAGS = ["$__RPATH"]) # workaround for SCons bug #1644t
test_env.AppendUnique(LIBS=lib)
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 ("dtype", "ufunc", "templates", "ndarray", "indexing", "shapes"):
mod = test_env.LoadableModule("%s_mod" % name, "%s_mod.cpp" % name, LDMODULEPREFIX="")
if os.name == 'nt':
# Move the module to have the correct name.
mod = env.Command(os.path.join(Dir('.').srcnode().abspath, "%s_mod.pyd" % (name)),
mod,
Move(os.path.join(Dir('.').srcnode().abspath, "%s_mod.pyd" % (name)), mod[0]))
test.extend(PythonUnitTest(test_env, "%s.py" % name, mod))
Return("test")