aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-11-05 21:12:25 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-11-14 19:16:57 -0500
commitaa84c55bef6393b00b3c86eed77bfc00756c7ce9 (patch)
tree21ebe6778835e47b0ccf4a0f08f10d7cc33eb38e
parent6860e42c065a61cee2f31615fab99af1e20c8e50 (diff)
downloadmeson-aa84c55bef6393b00b3c86eed77bfc00756c7ce9.zip
meson-aa84c55bef6393b00b3c86eed77bfc00756c7ce9.tar.gz
meson-aa84c55bef6393b00b3c86eed77bfc00756c7ce9.tar.bz2
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.
-rw-r--r--test cases/python/2 extmodule/meson.build17
-rw-r--r--test cases/python3/3 cython/meson.build6
2 files changed, 18 insertions, 5 deletions
diff --git a/test cases/python/2 extmodule/meson.build b/test cases/python/2 extmodule/meson.build
index c3f4eec..239492c 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
diff --git a/test cases/python3/3 cython/meson.build b/test cases/python3/3 cython/meson.build
index 753b906..d41fc93 100644
--- a/test cases/python3/3 cython/meson.build
+++ b/test cases/python3/3 cython/meson.build
@@ -6,8 +6,14 @@ py3_dep = dependency('python3', required : false)
if cython.found() and py3_dep.found()
py3_dep = dependency('python3')
+ py3_dep_majver = py3_dep.version().split('.')
+ py3_dep_majver = py3_dep_majver[0] + '.' + py3_dep_majver[1]
py3_mod = import('python3')
py3 = py3_mod.find_python()
+ if py3_dep_majver != py3_mod.language_version()
+ v = py3_mod.language_version()
+ error('MESON_SKIP_TEST: deprecated python3 module is non-functional when default python3 is different from Meson\'s', v)
+ endif
subdir('libdir')
test('cython tester',