hammer/src/bindings/python/SConscript

24 lines
1.1 KiB
Text
Raw Normal View History

# -*- python -*-
import os, os.path
Import('env libhammer_shared testruns targets')
2013-11-17 20:56:03 -06:00
pythonenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
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')
Default(libhammer_python)
pytestenv = pythonenv.Clone()
pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
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")
pytest = Alias("testpython", [pytestexec], pytestexec)
AlwaysBuild(pytestexec)
testruns.append(pytest)
pyinstallexec = pythonenv.Command(None, libhammer_python, 'python ' + os.path.join(pydir, 'setup.py ') + ' install')
pyinstall = Alias("installpython", [pyinstallexec], pyinstallexec)
targets.append(pyinstall)