hammer/src/bindings/python/SConscript

32 lines
1.3 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'])
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"')
Default(libhammer_python)
pytestenv = pythonenv.Clone()
pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
pytests = ['hammer_tests.py']
pytestexec = pytestenv.Command(['hammer.pyc', 'hammer_tests.pyc'], pytests + libhammer_python, "nosetests -vv $SOURCE")
pytest = Alias("testpython", [pytestexec], pytestexec)
AlwaysBuild(pytest)
testruns.append(pytest)