2013-11-17 20:26:51 -06:00
|
|
|
# -*- python -*-
|
2013-11-26 15:29:28 -08:00
|
|
|
import os, os.path
|
2013-11-26 19:54:09 -08:00
|
|
|
Import('env libhammer_shared testruns targets')
|
2013-11-17 20:26:51 -06:00
|
|
|
|
2013-11-17 20:56:03 -06:00
|
|
|
pythonenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
|
2013-11-17 20:26:51 -06:00
|
|
|
|
2013-11-26 19:09:27 -08:00
|
|
|
swig = pythonenv.Command("hammer.i", "../swig/hammer.i", Copy("$TARGET", "$SOURCE"))
|
|
|
|
|
setup = ['setup.py']
|
|
|
|
|
pydir = os.path.join(env['BUILD_BASE'], 'src/bindings/python')
|
2013-11-26 19:25:41 -08:00
|
|
|
libhammer_python = pythonenv.Command(['hammer.py', 'hammer_wrap.c'], [swig, setup], 'python ' + os.path.join(pydir, 'setup.py') + ' build_ext --inplace')
|
2013-11-26 15:29:28 -08:00
|
|
|
Default(libhammer_python)
|
2013-11-18 21:14:44 -06:00
|
|
|
|
|
|
|
|
pytestenv = pythonenv.Clone()
|
2013-11-19 17:26:01 -06:00
|
|
|
pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
|
2013-11-26 15:40:15 -08:00
|
|
|
pytests = ['hammer_tests.py']
|
2013-11-26 19:25:41 -08:00
|
|
|
pytestexec = pytestenv.Command(['hammer.pyc', 'hammer_tests.pyc'], pytests + libhammer_python, "LD_LIBRARY_PATH=" + os.path.dirname(str(libhammer_shared[0])) + " nosetests -vv $SOURCE")
|
2013-11-26 15:29:28 -08:00
|
|
|
pytest = Alias("testpython", [pytestexec], pytestexec)
|
2013-12-05 08:41:28 +01:00
|
|
|
AlwaysBuild(pytestexec)
|
2014-01-05 01:57:19 +01:00
|
|
|
testruns.append(pytest)
|
2013-11-19 02:41:45 -06:00
|
|
|
|
2013-11-26 19:54:09 -08:00
|
|
|
pyinstallexec = pythonenv.Command(None, libhammer_python, 'python ' + os.path.join(pydir, 'setup.py ') + ' install')
|
|
|
|
|
pyinstall = Alias("installpython", [pyinstallexec], pyinstallexec)
|
|
|
|
|
targets.append(pyinstall)
|