diff options
| author | Eli Schwartz <eschwartz@archlinux.org> | 2022-11-05 21:12:25 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-11-14 19:16:57 -0500 |
| commit | aa84c55bef6393b00b3c86eed77bfc00756c7ce9 (patch) | |
| tree | 21ebe6778835e47b0ccf4a0f08f10d7cc33eb38e /test cases/python | |
| parent | 6860e42c065a61cee2f31615fab99af1e20c8e50 (diff) | |
| download | meson-aa84c55bef6393b00b3c86eed77bfc00756c7ce9.tar.gz | |
tests: fix edge case where non-default python is used, by skipping it
In a couple of python module tests, we try to test things that rely on
the default python being the same one we look up in the python module.
This is unsolvable for the deprecated python3 module, as it actually
uses the in-process version of python for everything. For the python
module, we could actually look up the default system python instead of
the one we are running with, but then we wouldn't be testing the
functionality of that alternative python... and also the install
manifest tests would see files installed for the wrong version of
python, and report a combination of missing+extra files...
Solve both tests by just skipping the parts we cannot check.
Diffstat (limited to 'test cases/python')
| -rw-r--r-- | test cases/python/2 extmodule/meson.build | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/test cases/python/2 extmodule/meson.build b/test cases/python/2 extmodule/meson.build index c3f4eec6a..239492c44 100644 --- a/test cases/python/2 extmodule/meson.build +++ b/test cases/python/2 extmodule/meson.build @@ -34,10 +34,17 @@ py.install_sources(blaster, subdir: 'pure') py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false) if py3_pkg_dep.found() - python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir') - - # Check we can apply a version constraint - dependency('python3', version: '>=@0@'.format(py_dep.version())) + py3_dep_majver = py3_pkg_dep.version().split('.') + py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1] + message(f'got two pythons: pkg-config is @py3_dep_majver@, and module is', py.language_version()) + if py3_dep_majver != py.language_version() + message('skipped python3 pkg-config test because the default python3 is different from Meson\'s') + else + python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir') + + # Check we can apply a version constraint + dependency('python3', version: '>=@0@'.format(py_dep.version())) + endif else - message('Skipped python3 pkg-config test') + message('Skipped python3 pkg-config test because it was not found') endif |
