2013-11-17 20:26:51 -06:00
|
|
|
# -*- python -*-
|
2013-11-26 15:29:28 -08:00
|
|
|
import os, os.path
|
|
|
|
|
Import('env libhammer_shared testruns')
|
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
|
|
|
#pythonenv.Append(CPPPATH = ['../../'])
|
|
|
|
|
#pythonenv.Append(CCFLAGS = ['-fpic', '-DSWIG', '-Wno-all', '-Wno-extra', '-Wno-error'])
|
|
|
|
|
#pythonenv.ParseConfig("pkg-config --cflags python")
|
|
|
|
|
#pythonenv.Append(LIBS = ['hammer'])
|
|
|
|
|
#pythonenv.Append(LIBPATH = ['../../'])
|
|
|
|
|
#pythonenv.Append(SWIGFLAGS = ['-DHAMMER_INTERNAL__NO_STDARG_H', '-Isrc/', '-python'])
|
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')
|
|
|
|
|
#libhammer_python = pythonenv.SharedLibrary('hammer', swig, SHLIBPREFIX='_')
|
|
|
|
|
libhammer_python = pythonenv.Command(None, [swig, setup], 'python ' + os.path.join(pydir, 'setup.py') + ' build_ext --swig-opts="-outdir ' + pydir + ' -DHAMMER_INTERNAL__NO_STDARG_H -Isrc"')
|
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']
|
|
|
|
|
pytestexec = pytestenv.Command(['hammer.pyc', 'hammer_tests.pyc'], pytests + libhammer_python, "nosetests -vv $SOURCE")
|
2013-11-26 15:29:28 -08:00
|
|
|
pytest = Alias("testpython", [pytestexec], pytestexec)
|
|
|
|
|
AlwaysBuild(pytest)
|
|
|
|
|
testruns.append(pytest)
|
2013-11-19 02:41:45 -06:00
|
|
|
|
2013-11-26 15:40:15 -08:00
|
|
|
|