Macronize getting versions of Python packages in %check

[skip changelog]
This commit is contained in:
Miro Hrončok
2026-02-13 12:11:44 +01:00
parent f77c181570
commit 83ad569efe
+5 -2
View File
@@ -126,9 +126,12 @@ export SETUPTOOLS_SCM_PRETEND_VERSION="%{version}"
%if %{with tests}
%check
# A macro that returns a version of the installed Python package, as an RPM v-string, defaults to v"0"
%define pyversion() v"%(%{python3} -c 'import importlib.metadata as im; print(im.version("%{1}"))' 2>/dev/null || echo 0)"
# Upstream requires virtualenv >= 20.31 for tests, and no longer sets VIRTUALENV_WHEEL.
# To support environments with older virtualenv, we set it manually:
%if v"%(%{python3} -c 'import importlib.metadata as im; print(im.version("virtualenv"))' 2>/dev/null || echo 0)" < v"20.31"
%if %{pyversion virtualenv} < v"20.31"
export VIRTUALENV_WHEEL=bundle
%endif
@@ -146,7 +149,7 @@ k="${k-}${k+ and }not test_str_convert_ok_py39"
# https://github.com/tox-dev/tox/commit/698f1dd663
# The tests fail with setuptools < 70.1
%if v"%(%{python3} -c 'import importlib.metadata as im; print(im.version("setuptools"))' 2>/dev/null || echo 0)" < v"70.1"
%if %{pyversion setuptools} < v"70.1"
k="${k-}${k+ and }not test_result_json_sequential"
k="${k-}${k+ and }not test_setuptools_package"
k="${k-}${k+ and }not test_skip_develop_mode"