diff --git a/macros.pyproject b/macros.pyproject index 4306b9e..6709fe9 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -219,7 +219,7 @@ if [ -f %{__python3} ]; then echo -n > %{_pyproject_buildrequires} %{_pyproject_build_flags} \\\ TMPDIR="%{_pyproject_builddir}" \\\ - RPM_TOXENV="%{toxenv}" HOSTNAME="rpmbuild" %{__python3} -Bs %{_rpmconfigdir}/redhat/pyproject_buildrequires.py %{?!_python_no_extras_requires:--generate-extras} --python3_pkgversion %{python3_pkgversion} --wheeldir %{_pyproject_wheeldir} --output %{_pyproject_buildrequires} %{?**} >&2 + RPM_TOXENV="%{toxenv}" FEDORA=%{?fedora} HOSTNAME="rpmbuild" %{__python3} -Bs %{_rpmconfigdir}/redhat/pyproject_buildrequires.py %{?!_python_no_extras_requires:--generate-extras} --python3_pkgversion %{python3_pkgversion} --wheeldir %{_pyproject_wheeldir} --output %{_pyproject_buildrequires} %{?**} >&2 cat %{_pyproject_buildrequires} fi # Incomplete .dist-info dir might confuse importlib.metadata diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 629df6c..843e282 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -193,6 +193,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog * Tue Mar 11 2025 Miro Hrončok - 1.18.0-1 - Make %%pyproject_buildrequires -t/-e and %%tox fail when no suitable tox configuration exists +- The %%pyproject_buildrequires -t/-e case is temporarily allowed on Fedora 40-42 - Requires tox-current-env >= 0.0.16 * Thu Jan 30 2025 Miro Hrončok - 1.17.0-1 diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index 2bda7cd..d90cf1e 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -22,6 +22,15 @@ from pyproject_wheel import parse_config_settings_args # Allow only the forms we know we can handle. VERSION_RE = re.compile(r'[a-zA-Z0-9.-]+(\.\*)?') +# To avoid breakage on Fedora 40-42, +# we don't assert tox configuration there. +# This can be removed when Fedora 42 goes EOL. +# Note that %tox still uses --assert-config +# because %tox without config is dangerous (false sense of tests). +# Running %pyproject_buildrequires -t/-e without tox config is wrong, but not dangerous. +FEDORA = int(os.getenv('FEDORA') or 0) +TOX_ASSERT_CONFIG_OPTS = ('--assert-config',) if 40 <= FEDORA < 43 else () + class EndPass(Exception): """End current pass of generating requirements""" @@ -426,7 +435,7 @@ def generate_tox_requirements(toxenv, requirements): '--print-deps-to', deps.name, '--print-extras-to', extras.name, '--no-provision', provision.name, - '--assert-config', + *TOX_ASSERT_CONFIG_OPTS, '-q', '-r', '-e', toxenv], check=False, encoding='utf-8',