diff options
Diffstat (limited to 'libnvme/meson.build')
-rw-r--r-- | libnvme/meson.build | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libnvme/meson.build b/libnvme/meson.build index 4138df3..12a601e 100644 --- a/libnvme/meson.build +++ b/libnvme/meson.build @@ -8,6 +8,7 @@ want_python = get_option('python') if want_python.disabled() build_python_bindings = false + py3_dep = dependency('', required: false) # Needed for muon else python3 = import('python').find_installation('python3') py3_dep = python3.dependency(required: want_python) @@ -17,11 +18,19 @@ else endif if build_python_bindings + r = run_command(swig, ['-version'], check: true) # Returns: "\nSWIG Version 4.1.1\n\nCompiled with ..." + swig_version = r.stdout().split('\n')[1].split()[2].strip() + if swig_version.version_compare('<4.1.0') + swig_cmd = [swig, '-python', '-py3', '-o', '@OUTPUT1@', '@INPUT0@'] + else + swig_cmd = [swig, '-python', '-o', '@OUTPUT1@', '@INPUT0@'] + endif + pymod_swig = custom_target( 'nvme.py', input: ['nvme.i'], output: ['nvme.py', 'nvme_wrap.c'], - command: [swig, '-python', '-py3', '-o', '@OUTPUT1@', '@INPUT0@'], + command: swig_cmd, install: true, install_dir: [python3.get_install_dir(pure: false, subdir: 'libnvme'), false], ) @@ -61,12 +70,13 @@ if build_python_bindings test('[Python] import libnvme', python3, args: ['-c', 'from libnvme import nvme'], env: test_env, depends: pynvme_clib) py_tests = [ - [ 'create ctrl object', files('tests/create-ctrl-obj.py') ], - [ 'SIGSEGV during gc', files('tests/gc.py') ], + [ 'create ctrl object', [ files('tests/create-ctrl-obj.py'), ] ], + [ 'SIGSEGV during gc', [ files('tests/gc.py'), ] ], + [ 'Read NBFT file', [ files('tests/test-nbft.py'), '--filename', join_paths(meson.current_source_dir(), 'tests', 'NBFT') ] ], ] foreach test: py_tests description = test[0] - py_script = test[1] - test('[Python] ' + description, python3, args: [py_script, ], env: test_env, depends: pynvme_clib) + args = test[1] + test('[Python] ' + description, python3, args: args, env: test_env, depends: pynvme_clib) endforeach endif |