hammer/src/bindings/python/SConscript

29 lines
1 KiB
Text
Raw Normal View History

# -*- python -*-
import os, os.path
Import('env libhammer_shared testruns')
2013-11-17 20:56:03 -06:00
pythonenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
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'])
pythonenv.Command("hammer.i", "../swig/hammer.i", Copy("$TARGET", "$SOURCE"))
swig = ['hammer.i']
libhammer_python = pythonenv.SharedLibrary('hammer', swig, SHLIBPREFIX='_')
Default(libhammer_python)
pytestenv = pythonenv.Clone()
pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
pytestexec = pytestenv.Command(None, ['hammer_tests.py'] + libhammer_python, "nosetests -vv $SOURCE")
pytest = Alias("testpython", [pytestexec], pytestexec)
AlwaysBuild(pytest)
testruns.append(pytest)
Clean('.', ['hammer.pyc', 'hammer_tests.py', 'hammer_tests.pyc'])