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>
This commit is contained in:
@@ -64,6 +64,12 @@ endif
|
|||||||
|
|
||||||
bash = find_program('bash', required : false)
|
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)
|
libcap_dep = dependency('libcap', required : true)
|
||||||
|
|
||||||
selinux_dep = dependency(
|
selinux_dep = dependency(
|
||||||
|
@@ -21,6 +21,11 @@ option(
|
|||||||
type : 'string',
|
type : 'string',
|
||||||
description : 'Prepend string to bwrap executable name, for use with subprojects',
|
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(
|
option(
|
||||||
'require_userns',
|
'require_userns',
|
||||||
type : 'boolean',
|
type : 'boolean',
|
||||||
|
@@ -46,10 +46,16 @@ foreach pair : test_programs
|
|||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
foreach test_script : test_scripts
|
foreach test_script : test_scripts
|
||||||
|
if test_script.endswith('.py')
|
||||||
|
interpreter = python
|
||||||
|
else
|
||||||
|
interpreter = bash
|
||||||
|
endif
|
||||||
|
|
||||||
if meson.version().version_compare('>=0.50.0')
|
if meson.version().version_compare('>=0.50.0')
|
||||||
test(
|
test(
|
||||||
test_script,
|
test_script,
|
||||||
bash,
|
interpreter,
|
||||||
args : [test_script],
|
args : [test_script],
|
||||||
env : test_env,
|
env : test_env,
|
||||||
protocol : 'tap',
|
protocol : 'tap',
|
||||||
@@ -57,7 +63,7 @@ foreach test_script : test_scripts
|
|||||||
else
|
else
|
||||||
test(
|
test(
|
||||||
test_script,
|
test_script,
|
||||||
bash,
|
interpreter,
|
||||||
args : [test_script],
|
args : [test_script],
|
||||||
env : test_env,
|
env : test_env,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user