diff options
author | Simon McVittie <smcv@collabora.com> | 2022-02-19 14:47:12 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2022-02-20 11:41:24 +0000 |
commit | 12c920b492d8c1536b26593b0bcbc984ea97419f (patch) | |
tree | 64ed85bdb0c7a48dca950653e9fd06ccfc50a085 | |
parent | 5750517e1c47d70e47ff9170586911ab99554267 (diff) | |
download | bubblewrap-12c920b492d8c1536b26593b0bcbc984ea97419f.tar.gz |
meson: Run the Python test script with Python, not bash
The python build option can be used to swap to a different interpreter,
for environments like the Steam Runtime where the python3 executable in
the PATH is extremely old but there is a better interpreter available.
This is treated as non-optional, because Meson is written in Python,
so the situation where there is no Python interpreter at build-time
shouldn't arise.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | meson.build | 6 | ||||
-rw-r--r-- | meson_options.txt | 5 | ||||
-rw-r--r-- | tests/meson.build | 10 |
3 files changed, 19 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 01fcc19..598c42e 100644 --- a/meson.build +++ b/meson.build @@ -64,6 +64,12 @@ endif bash = find_program('bash', required : false) +if get_option('python') == '' + python = find_program('python3') +else + python = find_program(get_option('python')) +endif + libcap_dep = dependency('libcap', required : true) selinux_dep = dependency( diff --git a/meson_options.txt b/meson_options.txt index aa88a2f..2fa3a8c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -22,6 +22,11 @@ option( description : 'Prepend string to bwrap executable name, for use with subprojects', ) option( + 'python', + type : 'string', + description : 'Path to Python 3, or empty to use python3', +) +option( 'require_userns', type : 'boolean', description : 'require user namespaces by default when installed setuid', diff --git a/tests/meson.build b/tests/meson.build index 12b7997..aabd1e0 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -46,10 +46,16 @@ foreach pair : test_programs endforeach foreach test_script : test_scripts + if test_script.endswith('.py') + interpreter = python + else + interpreter = bash + endif + if meson.version().version_compare('>=0.50.0') test( test_script, - bash, + interpreter, args : [test_script], env : test_env, protocol : 'tap', @@ -57,7 +63,7 @@ foreach test_script : test_scripts else test( test_script, - bash, + interpreter, args : [test_script], env : test_env, ) |