diff --git a/python-tox.spec b/python-tox.spec index 32c2dc5..2d0b59f 100644 --- a/python-tox.spec +++ b/python-tox.spec @@ -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"