diff options
author | David Robillard <d@drobilla.net> | 2013-12-19 17:50:01 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-12-19 17:50:01 +0000 |
commit | 05576eb9976357bc3870095c0d7e284c655ddb52 (patch) | |
tree | e096a9c604deb205f82d613e6065ee2d52ca6436 /wscript | |
parent | 9a6e476aa52737c328139396098a074804fc6781 (diff) | |
download | lilv-05576eb9976357bc3870095c0d7e284c655ddb52.tar.gz lilv-05576eb9976357bc3870095c0d7e284c655ddb52.tar.bz2 lilv-05576eb9976357bc3870095c0d7e284c655ddb52.zip |
Add support for running plugins from Python by Kaspar Emanuel (fix #939 and #940).
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5189 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'wscript')
-rw-r--r-- | wscript | 45 |
1 files changed, 43 insertions, 2 deletions
@@ -4,6 +4,8 @@ import subprocess import sys import waflib.Options as Options import waflib.extras.autowaf as autowaf +import waflib.Build as Build +import waflib.Logs as Logs # Library and package version (UNIX style major, minor, micro) # major increment <=> incompatible changes @@ -55,7 +57,7 @@ def configure(conf): conf.check_python_headers() autowaf.define(conf, 'LILV_PYTHON', 1); except: - pass + Logs.warn('Failed to configure Python (%s)\n' % sys.exc_info()[1]) autowaf.configure(conf) autowaf.set_c99_mode(conf) @@ -309,6 +311,36 @@ def build(bld): cflags = test_cflags) autowaf.use_lib(bld, obj, 'SERD SORD SRATOM LV2') + if bld.is_defined('LILV_PYTHON'): + # Copy Python unittest files + for i in [ 'test_api.py', 'test_api_mm.py' ]: + bld(features = 'subst', + is_copy = True, + source = 'bindings/test/python/' + i, + target = 'bindings/' + i, + install_path = None) + + # Build bindings test plugin + obj = bld(features = 'c cshlib', + env = penv, + source = 'bindings/test/bindings_test_plugin.c', + name = 'bindings_test_plugin', + target = 'bindings/bindings_test_plugin.lv2/bindings_test_plugin', + install_path = None, + defines = defines, + cflags = test_cflags, + lib = test_libs, + uselib = 'LV2') + + # Bindings test plugin data files + for i in [ 'manifest.ttl.in', 'bindings_test_plugin.ttl.in' ]: + bld(features = 'subst', + source = 'bindings/test/' + i, + target = 'bindings/bindings_test_plugin.lv2/' + i.replace('.in', ''), + install_path = None, + SHLIB_EXT = shlib_ext) + + # Utilities if bld.env.BUILD_UTILS: utils = ''' @@ -359,8 +391,17 @@ def fix_docs(ctx): def upload_docs(ctx): os.system('rsync -ravz --delete -e ssh build/doc/html/ drobilla@drobilla.net:~/drobilla.net/docs/lilv/') -def test(ctx): +# Inherit from build context so we can get the config data +class TestContext(Build.BuildContext): + cmd = 'test' + fun = 'test_function' + +def test_function(ctx): + assert ctx.env.BUILD_TESTS, "You have run waf configure without the --test flag. No tests were run." autowaf.pre_test(ctx, APPNAME) + if ctx.is_defined('LILV_PYTHON'): + os.environ['LD_LIBRARY_PATH'] = os.getcwd() + autowaf.run_tests(ctx, 'Python ' + APPNAME, ['python -m unittest discover bindings/']) os.environ['PATH'] = 'test' + os.pathsep + os.getenv('PATH') autowaf.run_tests(ctx, APPNAME, ['lilv_test'], dirs=['./src','./test']) autowaf.post_test(ctx, APPNAME) |