From a69fb4e1839c7ab893d03fd12ce180486b66e06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 15 Nov 2024 00:35:23 +0100 Subject: [PATCH 01/34] CI: %{pyproject_build_lib} changed on EL9 The actual value is still OK, but the tests were too strict. --- tests/double-install.spec | 8 +------- tests/python-ldap.spec | 2 -- tests/tldr.spec | 4 ---- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/tests/double-install.spec b/tests/double-install.spec index a065774..3481e16 100644 --- a/tests/double-install.spec +++ b/tests/double-install.spec @@ -46,13 +46,8 @@ cd .. %check # Internal check for the value of %%{pyproject_build_lib} -%if 0%{?rhel} == 9 -for dir in . markupsafe-%{markupsafe_version} tldr-%{tldr_version}; do - (cd $dir && test "%{pyproject_build_lib}" == "$(echo %{_pyproject_builddir}/pip-req-build-*/build/lib.%{python3_platform}-%{python3_version}):$(echo %{_pyproject_builddir}/pip-req-build-*/build/lib)") -done -%else cd markupsafe-%{markupsafe_version} -%if 0%{?fedora} == 36 +%if 0%{?rhel} == 9 test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/markupsafe-%{markupsafe_version}/build/lib.%{python3_platform}-%{python3_version}" %else test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/markupsafe-%{markupsafe_version}/build/lib.%{python3_platform}-cpython-%{python3_version_nodots}" @@ -60,7 +55,6 @@ test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/markupsafe-%{marku cd ../tldr-%{tldr_version} test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/tldr-%{tldr_version}/build/lib" cd .. -%endif %files diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index d36029b..c55ef14 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -95,8 +95,6 @@ grep -E '/site-packages/__pycache__/$' %{pyproject_files} && exit 1 || true # Internal check for the value of %%{pyproject_build_lib} in an archful package %if 0%{?rhel} == 9 -test "%{pyproject_build_lib}" == "$(echo %{_pyproject_builddir}/pip-req-build-*/build/lib.%{python3_platform}-%{python3_version})" -%elif 0%{?fedora} == 36 test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/build/lib.%{python3_platform}-%{python3_version}" %else test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/build/lib.%{python3_platform}-cpython-%{python3_version_nodots}" diff --git a/tests/tldr.spec b/tests/tldr.spec index 7152642..dfd190a 100644 --- a/tests/tldr.spec +++ b/tests/tldr.spec @@ -49,11 +49,7 @@ head -n1 %{buildroot}%{_bindir}/%{name}.py | grep -E '#!\s*%{python3}\s+%{py3_sh test ! -e %{buildroot}%{python3_sitelib}/*.dist-info/direct_url.json # Internal check for the value of %%{pyproject_build_lib} in a noarch package -%if 0%{?rhel} == 9 -test "%{pyproject_build_lib}" == "$(echo %{_pyproject_builddir}/pip-req-build-*/build/lib)" -%else test "%{pyproject_build_lib}" == "${PWD}/build/lib" -%endif %if 0%{?rhel} != 9 # Internal check for custom prefix From 665fd2456d1ae9e3babb00a75d99a280427c5295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 20 Nov 2024 13:24:57 +0100 Subject: [PATCH 02/34] CI: Simplify spec conditionals wrt Fedora 39 going EOL --- tests/python-httpbin.spec | 6 +++--- tests/python-setuptools.spec | 6 +++--- tests/python-virtualenv.spec | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/python-httpbin.spec b/tests/python-httpbin.spec index de0618f..dbc8963 100644 --- a/tests/python-httpbin.spec +++ b/tests/python-httpbin.spec @@ -10,8 +10,8 @@ BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros -%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10 -# Wekrzeug in Fedora 37 isn't compatible with our httpbin +%if 0%{?rhel} != 9 +# Wekrzeug in Fedora and EL10+ isn't compatible with our httpbin Patch: https://src.fedoraproject.org/rpms/python-httpbin/raw/0e4a7e2812/f/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch %endif @@ -61,7 +61,7 @@ sed -Ei 's/\bdef (test_(relative_)?redirect_(to_post|n_(equals_to|higher_than)_1 %if %{with tests} %check -%if 0%{?fedora} < 40 && 0%{?rhel} < 10 +%if 0%{?rhel} == 9 # this version of httpbin is not compatible with werkzeug 3+ %tox %endif diff --git a/tests/python-setuptools.spec b/tests/python-setuptools.spec index 76f11aa..4203c3d 100644 --- a/tests/python-setuptools.spec +++ b/tests/python-setuptools.spec @@ -1,7 +1,7 @@ Name: python-setuptools # on the CI we test different version of setuptools on different Fedora versions # don't package software like this in Fedora please -%if 0%{?fedora} || 0%{?rhel} >= 10 +%if 0%{?rhel} != 9 Version: 67.7.2 %else Version: 59.6.0 @@ -14,7 +14,7 @@ URL: https://pypi.python.org/pypi/setuptools Source: %{pypi_source setuptools %{version}} # Patch from Fedora proper -%if 0%{?fedora} || 0%{?rhel} >= 10 +%if 0%{?rhel} != 9 Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/8ae9b2a777c/f/Remove-optional-or-unpackaged-test-deps.patch %else Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/6fc093d6b3d/f/0001-Remove-optional-or-unpackaged-test-deps.patch @@ -54,7 +54,7 @@ Summary: %{summary} %prep %autosetup -p1 -n setuptools-%{version} -%if 0%{?rhel} && 0%{?rhel} < 10 +%if 0%{?rhel} == 9 # The following test deps are optional and either not desired or not available in Fedora: sed -Ei setup.cfg -e '/\bpytest-(checkdocs|black|cov|mypy|enabler)\b/d' \ -e '/\bflake8\b/d' \ diff --git a/tests/python-virtualenv.spec b/tests/python-virtualenv.spec index add7f78..39df3b2 100644 --- a/tests/python-virtualenv.spec +++ b/tests/python-virtualenv.spec @@ -37,7 +37,7 @@ sed -i -e 's/distlib<1,>=0.3.6/distlib<1,>=0.3.2/' \ # Drop the option for flaky sed -i 's/--no-success-flaky-report//' pyproject.toml # Hacky backport of https://src.fedoraproject.org/rpms/python-virtualenv/c/87b1f95664 -%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 +%if 0%{?rhel} != 9 sed -i 's/_nonwrappers/_hookimpls/' tests/conftest.py %endif From cd00547996da17489933dd78c4f9c3a6cbc0ad0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Mon, 2 Dec 2024 09:37:39 +0100 Subject: [PATCH 03/34] Change the test source location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the test source location to support evolving downstream testing requirements. This is needed both for downstream certification activities and changes to test development for internal infrastructure differences. Cherry-picked from https://gitlab.com/redhat/centos-stream/rpms/pyproject-rpm-macros/-/merge_requests/25 Co-Authored-By: Miro Hrončok --- README.md | 4 +- ...-location-header-autocorrect-for-wer.patch | 44 ++++++++++++++++++ ...ove-optional-or-unpackaged-test-deps.patch | 38 +++++++++++++++ ...ove-optional-or-unpackaged-test-deps.patch | 46 +++++++++++++++++++ tests/python-httpbin.spec | 2 +- .../python-ldap-always-use-ldap-library.patch | 34 ++++++++++++++ tests/python-ldap.spec | 2 +- tests/python-setuptools.spec | 4 +- 8 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch create mode 100644 tests/0001-Remove-optional-or-unpackaged-test-deps.patch create mode 100644 tests/Remove-optional-or-unpackaged-test-deps.patch create mode 100644 tests/python-ldap-always-use-ldap-library.patch diff --git a/README.md b/README.md index 192c04d..6401d39 100644 --- a/README.md +++ b/README.md @@ -565,11 +565,11 @@ For each `$PKG.spec` in `tests/`: - download the sources: - spectool -g -R $PKG.spec + spectool -g $PKG.spec - build a SRPM: - rpmbuild -bs $PKG.spec + rpmbuild -bs --define '_sourcedir .' $PKG.spec - build in mock, using the path from the command above as `$SRPM`: diff --git a/tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch b/tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch new file mode 100644 index 0000000..ef7886c --- /dev/null +++ b/tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch @@ -0,0 +1,44 @@ +From 06f390d522afb6d2d71bb601c2060a9fabe3f7de Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Mon, 19 Jul 2021 15:41:23 -0700 +Subject: [PATCH] Fix disabling of location header autocorrect for werkzeug 2+ + (#647) + +In werkzeug 2.0.0 and later, the Location header autocorrection +moved from BaseResponse to Response, so we need to set +`autocorrect_location_header = False` in `Response` not +`BaseResponse`. From 2.1.0, BaseResponse is removed and importing +it is an error, so we can't support both any more. + +Signed-off-by: Adam Williamson +--- + httpbin/core.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/httpbin/core.py b/httpbin/core.py +index 66a2ed6..fd2842c 100644 +--- a/httpbin/core.py ++++ b/httpbin/core.py +@@ -19,7 +19,7 @@ from flask import Flask, Response, request, render_template, redirect, jsonify a + from six.moves import range as xrange + from werkzeug.datastructures import WWWAuthenticate, MultiDict + from werkzeug.http import http_date +-from werkzeug.wrappers import BaseResponse ++from werkzeug.wrappers import Response as WzResponse + from werkzeug.http import parse_authorization_header + from raven.contrib.flask import Sentry + +@@ -48,7 +48,9 @@ def jsonify(*args, **kwargs): + return response + + # Prevent WSGI from correcting the casing of the Location header +-BaseResponse.autocorrect_location_header = False ++# and forcing it to be absolute. ++WzResponse.autocorrect_location_header = False ++ + + # Find the correct template folder when running from a different location + tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') +-- +2.36.0 + diff --git a/tests/0001-Remove-optional-or-unpackaged-test-deps.patch b/tests/0001-Remove-optional-or-unpackaged-test-deps.patch new file mode 100644 index 0000000..43e7610 --- /dev/null +++ b/tests/0001-Remove-optional-or-unpackaged-test-deps.patch @@ -0,0 +1,38 @@ +From 4612fd1b6b7f9d3fdbfad34863e5b04535bb44cc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Wed, 8 Dec 2021 10:22:37 +0100 +Subject: [PATCH] Remove optional or unpackaged test deps + +--- + setup.cfg | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/setup.cfg b/setup.cfg +index 0bc0101..442da7a 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -37,21 +37,11 @@ exclude = + [options.extras_require] + testing = + pytest >= 6 +- pytest-checkdocs >= 2.4 +- pytest-flake8 +- pytest-black >= 0.3.7; \ +- python_implementation != "PyPy" +- pytest-cov +- pytest-mypy; \ +- python_implementation != "PyPy" +- pytest-enabler >= 1.0.1 + + mock +- flake8-2020 + virtualenv>=13.0.0 + pytest-virtualenv>=1.2.7 # TODO: Update once man-group/pytest-plugins#188 is solved + wheel +- paver + pip>=19.1 # For proper file:// URLs support. + jaraco.envs>=2.2 + pytest-xdist +-- +2.33.1 + diff --git a/tests/Remove-optional-or-unpackaged-test-deps.patch b/tests/Remove-optional-or-unpackaged-test-deps.patch new file mode 100644 index 0000000..60f0941 --- /dev/null +++ b/tests/Remove-optional-or-unpackaged-test-deps.patch @@ -0,0 +1,46 @@ +From a03fa24ad65286ad9f2dc8bf1934bc84525ed06f Mon Sep 17 00:00:00 2001 +From: Charalampos Stratakis +Date: Wed, 8 Mar 2023 02:48:31 +0100 +Subject: [PATCH] Remove optional or unpackaged test deps + +--- + setup.cfg | 16 ---------------- + 1 file changed, 16 deletions(-) + +diff --git a/setup.cfg b/setup.cfg +index 4791ed6..2776b31 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -39,20 +39,6 @@ exclude = + [options.extras_require] + testing = + pytest >= 6 +- pytest-checkdocs >= 2.4 +- pytest-flake8; \ +- python_version < "3.12" +- flake8 < 5 +- pytest-black >= 0.3.7; \ +- python_implementation != "PyPy" +- pytest-cov; \ +- python_implementation != "PyPy" +- pytest-mypy >= 0.9.1; \ +- python_implementation != "PyPy" +- pytest-enabler >= 1.3 +- pytest-perf +- +- flake8-2020 + virtualenv>=13.0.0 + wheel + pip>=19.1 # For proper file:// URLs support. +@@ -60,8 +46,6 @@ testing = + pytest-xdist + jaraco.path>=3.2.0 + build[virtualenv] +- filelock>=3.4.0 +- pip_run>=8.8 + ini2toml[lite]>=0.9 + tomli-w>=1.0.0 + pytest-timeout +-- +2.39.2 + diff --git a/tests/python-httpbin.spec b/tests/python-httpbin.spec index dbc8963..72e1165 100644 --- a/tests/python-httpbin.spec +++ b/tests/python-httpbin.spec @@ -12,7 +12,7 @@ BuildRequires: pyproject-rpm-macros %if 0%{?rhel} != 9 # Wekrzeug in Fedora and EL10+ isn't compatible with our httpbin -Patch: https://src.fedoraproject.org/rpms/python-httpbin/raw/0e4a7e2812/f/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch +Patch: 0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch %endif # no flask, itsdangerous, raven, werkzeug packaged for EPEL 9 yet diff --git a/tests/python-ldap-always-use-ldap-library.patch b/tests/python-ldap-always-use-ldap-library.patch new file mode 100644 index 0000000..5c56650 --- /dev/null +++ b/tests/python-ldap-always-use-ldap-library.patch @@ -0,0 +1,34 @@ +From 536a7671151e3070481736e5d6159987df920d8b Mon Sep 17 00:00:00 2001 +From: Simon Pichugin +Date: Wed, 9 Feb 2022 16:06:14 -0800 +Subject: [PATCH] Always use 'ldap' library + +--- + setup.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 119b571..851223e 100644 +--- a/setup.py ++++ b/setup.py +@@ -37,6 +37,8 @@ if cfg.has_section('_ldap'): + for name in dir(LDAP_CLASS): + if cfg.has_option('_ldap', name): + setattr(LDAP_CLASS, name, cfg.get('_ldap', name).split()) ++#-- Overwrite it as 'ldap' is the always correct library we have in Fedora 34+ ++LDAP_CLASS.libs = ['ldap', 'lber'] + + for i in range(len(LDAP_CLASS.defines)): + LDAP_CLASS.defines[i]=((LDAP_CLASS.defines[i],None)) +@@ -132,7 +134,7 @@ setup( + extra_objects = LDAP_CLASS.extra_objects, + runtime_library_dirs = (not sys.platform.startswith("win"))*LDAP_CLASS.library_dirs, + define_macros = LDAP_CLASS.defines + \ +- ('ldap_r' in LDAP_CLASS.libs or 'oldap_r' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \ ++ ('ldap' in LDAP_CLASS.libs or 'oldap' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \ + ('sasl' in LDAP_CLASS.libs or 'sasl2' in LDAP_CLASS.libs or 'libsasl' in LDAP_CLASS.libs)*[('HAVE_SASL',None)] + \ + ('ssl' in LDAP_CLASS.libs and 'crypto' in LDAP_CLASS.libs)*[('HAVE_TLS',None)] + \ + [ +-- +2.31.1 + diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index c55ef14..6327f8c 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -8,7 +8,7 @@ Source0: %{pypi_source} # OpenLDAP 2.5+ is not yet supported by python-ldap # https://github.com/python-ldap/python-ldap/issues/432 # Fedora has this patch to make it build, but the tests will fail anyway -Patch0: https://src.fedoraproject.org/rpms/python-ldap/raw/a237d9b212bd1581e07f4f1a8f54c26a7190843c/f/python-ldap-always-use-ldap-library.patch +Patch0: python-ldap-always-use-ldap-library.patch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros diff --git a/tests/python-setuptools.spec b/tests/python-setuptools.spec index 4203c3d..307fbf7 100644 --- a/tests/python-setuptools.spec +++ b/tests/python-setuptools.spec @@ -15,9 +15,9 @@ Source: %{pypi_source setuptools %{version}} # Patch from Fedora proper %if 0%{?rhel} != 9 -Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/8ae9b2a777c/f/Remove-optional-or-unpackaged-test-deps.patch +Patch: Remove-optional-or-unpackaged-test-deps.patch %else -Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/6fc093d6b3d/f/0001-Remove-optional-or-unpackaged-test-deps.patch +Patch: 0001-Remove-optional-or-unpackaged-test-deps.patch %endif BuildArch: noarch From d0e32d9246847d7e77d3ce8a4a46ab32556934e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 2 Dec 2024 19:24:52 +0100 Subject: [PATCH 04/34] CI: Rename in-tree patches to make them nicer in a single directory --- ...rect-for-wer.patch => python-httpbin-werkzeug-2.1.patch} | 0 tests/python-httpbin.spec | 2 +- ...ls-59.6.0-remove-optional-or-unpackaged-test-deps.patch} | 0 ...ls-67.7.2-remove-optional-or-unpackaged-test-deps.patch} | 0 tests/python-setuptools.spec | 6 +----- 5 files changed, 2 insertions(+), 6 deletions(-) rename tests/{0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch => python-httpbin-werkzeug-2.1.patch} (100%) rename tests/{0001-Remove-optional-or-unpackaged-test-deps.patch => python-setuptools-59.6.0-remove-optional-or-unpackaged-test-deps.patch} (100%) rename tests/{Remove-optional-or-unpackaged-test-deps.patch => python-setuptools-67.7.2-remove-optional-or-unpackaged-test-deps.patch} (100%) diff --git a/tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch b/tests/python-httpbin-werkzeug-2.1.patch similarity index 100% rename from tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch rename to tests/python-httpbin-werkzeug-2.1.patch diff --git a/tests/python-httpbin.spec b/tests/python-httpbin.spec index 72e1165..7e7a49e 100644 --- a/tests/python-httpbin.spec +++ b/tests/python-httpbin.spec @@ -12,7 +12,7 @@ BuildRequires: pyproject-rpm-macros %if 0%{?rhel} != 9 # Wekrzeug in Fedora and EL10+ isn't compatible with our httpbin -Patch: 0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch +Patch: python-httpbin-werkzeug-2.1.patch %endif # no flask, itsdangerous, raven, werkzeug packaged for EPEL 9 yet diff --git a/tests/0001-Remove-optional-or-unpackaged-test-deps.patch b/tests/python-setuptools-59.6.0-remove-optional-or-unpackaged-test-deps.patch similarity index 100% rename from tests/0001-Remove-optional-or-unpackaged-test-deps.patch rename to tests/python-setuptools-59.6.0-remove-optional-or-unpackaged-test-deps.patch diff --git a/tests/Remove-optional-or-unpackaged-test-deps.patch b/tests/python-setuptools-67.7.2-remove-optional-or-unpackaged-test-deps.patch similarity index 100% rename from tests/Remove-optional-or-unpackaged-test-deps.patch rename to tests/python-setuptools-67.7.2-remove-optional-or-unpackaged-test-deps.patch diff --git a/tests/python-setuptools.spec b/tests/python-setuptools.spec index 307fbf7..fbc554b 100644 --- a/tests/python-setuptools.spec +++ b/tests/python-setuptools.spec @@ -14,11 +14,7 @@ URL: https://pypi.python.org/pypi/setuptools Source: %{pypi_source setuptools %{version}} # Patch from Fedora proper -%if 0%{?rhel} != 9 -Patch: Remove-optional-or-unpackaged-test-deps.patch -%else -Patch: 0001-Remove-optional-or-unpackaged-test-deps.patch -%endif +Patch: python-setuptools-%{version}-remove-optional-or-unpackaged-test-deps.patch BuildArch: noarch From c1de18f683ce58da054e1bbe9b85cdeb14668957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 12 Nov 2024 01:14:19 +0100 Subject: [PATCH 05/34] Accept arbitrary options from %pyproject_buildrequires in pyproject-srpm-macros This way, when we add new options to the actual macro in pyproject-rpm-macros, spec files that use them are parsable with the old pyproject-srpm-macros package. Last time, when we added the -g option in 1.16.0, it took at least a week for Fedora CI to be able to parse a spec file with it, as pyproject-srpm-macros 1.16.0+ needed to actually be installed on the CI systems. Next time this happens, the new option will be parsable with older versions of pyproject-rpm-macros Note that the (-) syntax is not supported yet on RPM 4.16 in RHEL 9. I'd use an expression to keep the literal set of flags for older RPM versions: %pyproject_buildrequires(%[v"0%{?rpmversion}" >= v"4.19" ? "-" : "rRxtNwpe:g:C:"]) But macro options are not processed as macros: https://github.com/rpm-software-management/rpm/issues/3440 As a result, this is not compatible with RHEL 9 and cannot be backported to it. Unless the (-) syntax is backported: https://issues.redhat.com/browse/RHEL-67161 https://gitlab.com/redhat/centos-stream/rpms/rpm/-/merge_requests/60 --- macros.aaa-pyproject-srpm | 4 ++-- macros.pyproject | 1 - pyproject-rpm-macros.spec | 14 ++++++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/macros.aaa-pyproject-srpm b/macros.aaa-pyproject-srpm index 1b06ac3..b394be5 100644 --- a/macros.aaa-pyproject-srpm +++ b/macros.aaa-pyproject-srpm @@ -3,8 +3,8 @@ # When this file is installed but macros.pyproject is not # this macro will cause the package with the real macro to be installed. # When macros.pyproject is installed, it overrides this macro. -# Note: This needs to maintain the same set of options as the real macro. -%pyproject_buildrequires(rRxtNwpe:g:C:) echo 'pyproject-rpm-macros' && exit 0 +# Note: This takes arbitrary options, to ease addition of new options to the real macro. +%pyproject_buildrequires(-) echo 'pyproject-rpm-macros' && exit 0 # Declarative buildsystem, requires RPM 4.20+ to work diff --git a/macros.pyproject b/macros.pyproject index 449afe6..af6b441 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -166,7 +166,6 @@ fi ]"\ ] -# Note: Keep the options in sync with this macro from macros.aaa-pyproject-srpm %pyproject_buildrequires(rRxtNwpe:g:C:) %{expand:\\\ %_set_pytest_addopts # The default flags expect the package note file to exist diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index de6ef3c..1886cf2 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.16.2 +Version: 1.16.3 Release: 1%{?dist} # Macro files @@ -137,15 +137,9 @@ install -pm 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/redha install -pm 644 pyproject_requirements_txt.py %{buildroot}%{_rpmconfigdir}/redhat/ install -pm 644 pyproject_wheel.py %{buildroot}%{_rpmconfigdir}/redhat/ -%check -# assert the two signatures of %%pyproject_buildrequires match exactly -signature1="$(grep '^%%pyproject_buildrequires' macros.pyproject | cut -d' ' -f1)" -signature2="$(grep '^%%pyproject_buildrequires' macros.aaa-pyproject-srpm | cut -d' ' -f1)" -test "$signature1" == "$signature2" -# but also assert we are not comparing empty strings -test "$signature1" != "" %if %{with tests} +%check export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856356 %pytest -vv --doctest-modules %{?with_pytest_xdist:-n auto} %{!?with_tox_tests:-k "not tox"} @@ -173,6 +167,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Tue Dec 03 2024 Miro Hrončok - 1.16.3-1 +- Accept arbitrary options from %%pyproject_buildrequires in pyproject-srpm-macros +- This will make future additions smoother + * Wed Nov 13 2024 Miro Hrončok - 1.16.2-1 - Fix one remaining test for setuptools 70+ From ee9d130fdc4c98bf0e5561b77cebe8c225a2b999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 3 Dec 2024 16:18:18 +0100 Subject: [PATCH 06/34] Deprecate the provisional -w flag for %pyproject_buildrequires The option was provisional, so it had no compatibility guarantees. We keep the option anyway: there will be no removals just for the sake of removals. All remaining usages in Fedora Rawhide have open Pull Requests to replace it with -p, or remove it entirely. Examples: https://src.fedoraproject.org/rpms/python-scikit-misc/pull-request/13 https://src.fedoraproject.org/rpms/python-traitlets/pull-request/8 https://src.fedoraproject.org/rpms/packit/pull-request/1402 --- README.md | 34 +++++++++------------------------- macros.pyproject | 4 ++++ pyproject-rpm-macros.spec | 5 ++++- pyproject_buildrequires.py | 7 +++---- 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 6401d39..815f2ce 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ using the `-R` flag: %pyproject_buildrequires -R Alternatively, if the project specifies its dependencies in the pyproject.toml -`[project]` table (as defined in [PEP 621](https://www.python.org/dev/peps/pep-0621/)), +`[project]` table (as defined in [PEP 621]), the runtime dependencies can be obtained by reading that metadata. This can be enabled by using the `-p` flag. @@ -92,28 +92,6 @@ Please note that not all build backends which use pyproject.toml support the For example, poetry-core (at least in 1.9.0) defines package metadata in the custom `[tool.poetry]` table which is not supported by the `%pyproject_buildrequires` macro. -Finally, the runtime dependencies can be obtained by building the wheel and reading the metadata from the built wheel. -This can be enabled with the `-w` flag and cannot be combined with `-p`. -Support for building wheels with `%pyproject_buildrequires -w` is **provisional** and the behavior might change. -Please subscribe to Fedora's [python-devel list] if you use the option. - - %generate_buildrequires - %pyproject_buildrequires -w - -When this is used, the wheel is going to be built at least twice, -becasue the `%generate_buildrequires` section runs repeatedly. -To avoid accidentally reusing a wheel leaking from a previous (different) build, -it cannot be reused between `%generate_buildrequires` rounds. -Contrarily to that, rebuilding the wheel again in the `%build` section is redundant -and the packager can omit the `%build` section entirely -to reuse the wheel built from the last round of `%generate_buildrequires`. -Be extra careful when attempting to modify the sources after `%pyproject_buildrequires`, -e.g. when running extra commands in the `%build` section: - - %build - cython src/wrong.pyx # this is too late with %%pyproject_buildrequires -w - %pyproject_wheel - For projects that specify test requirements using an [`extra` provide](https://packaging.python.org/specifications/core-metadata/#provides-extra-multiple-use), these can be added using the `-x` flag. @@ -167,7 +145,7 @@ in worst case, patch/sed the requirement out from the tox configuration. Note that neither `-x` or `-t` can be used with `-R` or `-N`, because runtime dependencies are always required for testing. You can only use those options if the build backend supports the [prepare-metadata-for-build-wheel hook], -or together with `-p` or `-w`. +or together with `-p`. However, using `-g` with `-R` or `-N` is supported because dependency groups don't need to be used for testing and can be obtained by reading `pyproject.toml` only. @@ -184,7 +162,7 @@ Dependencies will be loaded from them: For packages not using build system you can use `-N` to entirely skip automatical generation of requirements and install requirements only from manually specified files. `-N` option implies `-R` and cannot be used in combination with other options mentioned above -(`-w`, `-e`, `-t`, `-x`, `-p`). +(`-e`, `-t`, `-x`, `-p`). The `%pyproject_buildrequires` macro also accepts the `-r` flag for backward compatibility; it means "include runtime dependencies" which has been the default since version 0-53. @@ -532,6 +510,7 @@ so be prepared for problems. [PEP 508]: https://www.python.org/dev/peps/pep-0508/ [PEP 517]: https://www.python.org/dev/peps/pep-0517/ [PEP 518]: https://www.python.org/dev/peps/pep-0518/ +[PEP 621]: https://www.python.org/dev/peps/pep-0621/ [PEP 639]: https://www.python.org/dev/peps/pep-0639/ [PEP 735]: https://www.python.org/dev/peps/pep-0735/ [pip's documentation]: https://pip.pypa.io/en/stable/cli/pip_install/#vcs-support @@ -542,6 +521,11 @@ Deprecated The `%{pyproject_build_lib}` macro is deprecated, don't use it. +The `%pyproject_buildrequires` `-w` option is deprecated, don't use it. +If the build backend does not support the [prepare-metadata-for-build-wheel hook], +consider using the `-p` flag to read the metadata from the pyproject.toml +`[project]` table (as defined in [PEP 621]) instead. + Testing the macros ------------------ diff --git a/macros.pyproject b/macros.pyproject index af6b441..aa6ae73 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -192,6 +192,10 @@ fi fi} } %{-w: +%{!?__pyproject_buildrequires_w_warned:%{warn:The %%pyproject_buildrequires -w option is deprecated. +It's not efficient to build the wheel several times during the build. +The option is not scheduled for removal, but packagers should use the -p option instead. +}%global __pyproject_buildrequires_w_warned 1} %{-p:%{error:The -w and -p options are mutually exclusive}} } %{-e:%{expand:%global toxenv %(%{__python3} -s %{_rpmconfigdir}/redhat/pyproject_construct_toxenv.py %{?**})}} diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 1886cf2..c6d7ea0 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.16.3 +Version: 1.16.4 Release: 1%{?dist} # Macro files @@ -167,6 +167,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Tue Dec 03 2024 Miro Hrončok - 1.16.4-1 +- Deprecate the provisional -w flag for %%pyproject_buildrequires + * Tue Dec 03 2024 Miro Hrončok - 1.16.3-1 - Accept arbitrary options from %%pyproject_buildrequires in pyproject-srpm-macros - This will make future additions smoother diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index e0ef7de..da8a239 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -322,9 +322,8 @@ def generate_run_requirements_hook(backend, requirements): 'The build backend cannot provide build metadata ' '(incl. runtime requirements) before build. ' 'If the dependencies are specified in the pyproject.toml [project] ' - 'table, you can use the -p flag to read them.' - 'Alternatively, use the provisional -w flag to build the wheel and parse the metadata from it, ' - 'or use the -R flag not to generate runtime dependencies.' + 'table, you can use the -p flag to read them. ' + 'Alternatively, use the -R flag not to generate runtime dependencies.' ) dir_basename = prepare_metadata('.', config_settings=requirements.config_settings) with open(dir_basename + '/METADATA') as metadata_file: @@ -669,7 +668,7 @@ def main(argv): parser.add_argument( '-w', '--wheel', action='store_true', default=False, help=('Generate run-time requirements by building the wheel ' - '(useful for build backends without the prepare_metadata_for_build_wheel hook)'), + '(useful for build backends without the prepare_metadata_for_build_wheel hook, deprecated)'), ) parser.add_argument( '-p', '--read-pyproject-dependencies', action='store_true', default=False, From 79d31f177e52ee5a0a4aa73f290bfd2514e30682 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 18 Jan 2025 11:18:54 +0000 Subject: [PATCH 07/34] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- pyproject-rpm-macros.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index c6d7ea0..cc8e85b 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -15,7 +15,7 @@ License: MIT # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change Version: 1.16.4 -Release: 1%{?dist} +Release: 2%{?dist} # Macro files Source001: macros.pyproject @@ -167,6 +167,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Sat Jan 18 2025 Fedora Release Engineering - 1.16.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Tue Dec 03 2024 Miro Hrončok - 1.16.4-1 - Deprecate the provisional -w flag for %%pyproject_buildrequires From aac6644d020333d35714e2401b00acea79b6e05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 7 Jan 2025 12:54:18 +0100 Subject: [PATCH 08/34] Add the -M flag to %pyproject_save_files - The flag can be used to indicate no Python modules should be saved The change wrt users using '*' was necessary, as `glob` was undefined when `module_globs` was empty. --- README.md | 8 ++++++ macros.pyproject | 2 +- pyproject-rpm-macros.spec | 8 ++++-- pyproject_save_files.py | 26 ++++++++++++++---- tests/python-coverage-pth.spec | 50 ++++++++++++++++++++++++++++++++++ tests/tests.yml | 3 ++ 6 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 tests/python-coverage-pth.spec diff --git a/README.md b/README.md index 815f2ce..8e2dd5d 100644 --- a/README.md +++ b/README.md @@ -289,6 +289,14 @@ However, in Fedora packages, always list executables explicitly to avoid uninten %doc README.rst %{_bindir}/downloader +If the package has no Python modules in it, you can explicitly use `-M` to denote that. + + %install + %pyproject_install + %pyproject_save_files -M + +Otherwise, at least one module-glob argument is required. + `%pyproject_save_files` can automatically mark license files with `%license` macro and language (`*.mo`) files with `%lang` macro and appropriate language code. Only license files declared via [PEP 639] `License-File` field are detected. diff --git a/macros.pyproject b/macros.pyproject index aa6ae73..e5aedd9 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -122,7 +122,7 @@ fi # https://github.com/rpm-software-management/rpm/issues/1749#issuecomment-1020420616 # Since we support both ways, we pass either 4.19 or 4.18 to the script, so it knows which one to use # Rather than passing the actual version, we let RPM compare the versions, as it is easier done here than in Python -%pyproject_save_files(lL) %{expand:\\\ +%pyproject_save_files(lLM) %{expand:\\\ %{expr:v"0%{?rpmversion}" >= v"4.18.90" ? "RPM_FILES_ESCAPE=4.19" : "RPM_FILES_ESCAPE=4.18" } \\ %{__python3} %{_rpmconfigdir}/redhat/pyproject_save_files.py \\ --output-files "%{pyproject_files}" \\ diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index cc8e85b..3b05197 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,8 +14,8 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.16.4 -Release: 2%{?dist} +Version: 1.17.0 +Release: 1%{?dist} # Macro files Source001: macros.pyproject @@ -167,6 +167,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Thu Jan 30 2025 Miro Hrončok - 1.17.0-1 +- Add the -M flag to %%pyproject_save_files +- The flag can be used to indicate no Python modules should be saved + * Sat Jan 18 2025 Fedora Release Engineering - 1.16.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/pyproject_save_files.py b/pyproject_save_files.py index 93de7a2..dd6b05c 100644 --- a/pyproject_save_files.py +++ b/pyproject_save_files.py @@ -614,8 +614,10 @@ def generate_file_list(paths_dict, module_globs, include_others=False): # Users using '*' don't care about the files in the package, so it's ok # not to fail the build when no modules are detected # There can be legitimate reasons to create a package without Python modules - if not modules and fnmatch.fnmatchcase("", glob): - done_globs.add(glob) + if not modules: + for glob in module_globs: + if fnmatch.fnmatchcase("", glob): + done_globs.add(glob) missed = module_globs - done_globs if missed: @@ -782,7 +784,7 @@ def dist_metadata(buildroot, record_path): return dist.metadata -def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_version, pyproject_record, prefix, assert_license, varargs): +def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_version, pyproject_record, prefix, assert_license, allow_no_modules, varargs): """ Takes arguments from the %{pyproject_save_files} macro @@ -797,6 +799,15 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio sitedirs = sorted({sitelib, sitearch}) globs, include_auto = parse_varargs(varargs) + if not globs and not allow_no_modules: + raise ValueError( + "At least one module glob needs to be provided to %pyproject_save_files. " + "Alternatively, use -M to indicate no Python modules should be saved." + ) + if globs and allow_no_modules: + raise ValueError( + "%pyproject_save_files -M cannot be used together with module globs." + ) parsed_records = load_parsed_record(pyproject_record) final_file_list = [] @@ -840,6 +851,7 @@ def main(cli_args): cli_args.pyproject_record, cli_args.prefix, cli_args.assert_license, + cli_args.allow_no_modules, cli_args.varargs, ) @@ -853,7 +865,7 @@ def argparser(): prog="%pyproject_save_files", add_help=False, # custom usage to add +auto - usage="%(prog)s [-l|-L] MODULE_GLOB [MODULE_GLOB ...] [+auto]", + usage="%(prog)s [-l|-L] MODULE_GLOB|-M [MODULE_GLOB ...] [+auto]", ) parser.add_argument( '--help', action='help', @@ -878,7 +890,11 @@ def argparser(): help="Don't fail when no License-File (PEP 639) is found (the default).", ) parser.add_argument( - "varargs", nargs="+", metavar="MODULE_GLOB", + "-M", "--allow-no-modules", action="store_true", default=False, + help="Don't fail when no globs are provided, only include non-modules data in the generated filelist.", + ) + parser.add_argument( + "varargs", nargs="*", metavar="MODULE_GLOB", help="Shell-like glob matching top-level module names to save into %%{pyproject_files}", ) return parser diff --git a/tests/python-coverage-pth.spec b/tests/python-coverage-pth.spec new file mode 100644 index 0000000..e947899 --- /dev/null +++ b/tests/python-coverage-pth.spec @@ -0,0 +1,50 @@ +Name: python-coverage-pth +Version: 0.0.2 +Release: 0%{?dist} +Summary: Coverage PTH file to enable coverage at the virtualenv level +License: BSD +URL: https://github.com/dougn/coverage_pth +Source: %{pypi_source coverage_pth} + +BuildArch: noarch +BuildRequires: python3-devel + +%description +This package exists to test %%pyproject_save_files -M. +It contains no Python modules, just a single .pth file. + + +%package -n python3-coverage-pth +Summary: %{summary} + +%description -n python3-coverage-pth +... + + +%prep +%autosetup -p1 -n coverage_pth-%{version} +# support multi-digit Python versions in setup.py regexes +sed -i 's/d)/d+)/' setup.py + + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install + +# internal check for our macros: +# this should not work without -M +%pyproject_save_files -L && exit 1 || true + +# but this should: +%pyproject_save_files -LM + + +%files -n python3-coverage-pth -f %{pyproject_files} +%{python3_sitelib}/coverage_pth.pth diff --git a/tests/tests.yml b/tests/tests.yml index c795324..3fbff89 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -94,6 +94,9 @@ - virtualenv: dir: . run: ./mocktest.sh python-virtualenv + - coverage_pth: + dir: . + run: ./mocktest.sh python-coverage-pth - pello: dir: . run: ./mocktest.sh python-pello From ac4f008073ef7ef0c1b0b600dce369526b63d4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 31 Jan 2025 12:36:56 +0100 Subject: [PATCH 09/34] CI: Convert all test spec License tags to SPDX python-ldap is a SPDX tag: https://spdx.org/licenses/python-ldap.html --- tests/double-install.spec | 2 +- tests/printrun.spec | 2 +- tests/python-coverage-pth.spec | 2 +- tests/python-distroinfo.spec | 2 +- tests/python-django.spec | 2 +- tests/python-flit-core.spec | 2 +- tests/python-ipykernel.spec | 2 +- tests/python-ldap.spec | 2 +- tests/python-markupsafe.spec | 2 +- tests/python-mistune.spec | 2 +- tests/python-openqa_client.spec | 2 +- tests/python-setuptools.spec | 2 +- tests/python-zope-event.spec | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/double-install.spec b/tests/double-install.spec index 3481e16..b1ea68b 100644 --- a/tests/double-install.spec +++ b/tests/double-install.spec @@ -2,7 +2,7 @@ Name: double-install Version: 0 Release: 0%{?dist} Summary: Install 2 wheels -License: BSD and MIT +License: BSD-3-Clause AND MIT %global markupsafe_version 2.0.1 %global tldr_version 0.4.4 Source1: https://github.com/pallets/markupsafe/archive/%{markupsafe_version}/MarkupSafe-%{markupsafe_version}.tar.gz diff --git a/tests/printrun.spec b/tests/printrun.spec index 96a9caa..08e0f67 100644 --- a/tests/printrun.spec +++ b/tests/printrun.spec @@ -3,7 +3,7 @@ Version: 2.0.0~rc6 %global upstream_version 2.0.0rc6 Release: 0%{?dist} Summary: RepRap printer interface and tools -License: GPLv3+ and FSFAP +License: GPL-3.0-or-later AND FSFAP URL: https://github.com/kliment/Printrun Source0: https://github.com/kliment/Printrun/archive/%{name}-%{upstream_version}.tar.gz diff --git a/tests/python-coverage-pth.spec b/tests/python-coverage-pth.spec index e947899..a0d1096 100644 --- a/tests/python-coverage-pth.spec +++ b/tests/python-coverage-pth.spec @@ -2,7 +2,7 @@ Name: python-coverage-pth Version: 0.0.2 Release: 0%{?dist} Summary: Coverage PTH file to enable coverage at the virtualenv level -License: BSD +License: BSD-2-Clause URL: https://github.com/dougn/coverage_pth Source: %{pypi_source coverage_pth} diff --git a/tests/python-distroinfo.spec b/tests/python-distroinfo.spec index e754324..9d3128a 100644 --- a/tests/python-distroinfo.spec +++ b/tests/python-distroinfo.spec @@ -2,7 +2,7 @@ Name: python-distroinfo Version: 0.3.2 Release: 0%{?dist} Summary: Parsing and querying distribution metadata stored in text/YAML files -License: ASL 2.0 +License: Apache-2.0 URL: https://github.com/softwarefactory-project/distroinfo Source0: %{pypi_source distroinfo} BuildArch: noarch diff --git a/tests/python-django.spec b/tests/python-django.spec index 74f6d72..a3ab773 100644 --- a/tests/python-django.spec +++ b/tests/python-django.spec @@ -2,7 +2,7 @@ Name: python-django Version: 3.0.7 Release: 0%{?dist} Summary: A high-level Python Web framework -License: BSD +License: BSD-3-Clause URL: https://www.djangoproject.com/ Source0: %{pypi_source Django} BuildArch: noarch diff --git a/tests/python-flit-core.spec b/tests/python-flit-core.spec index e6831dc..11c2315 100644 --- a/tests/python-flit-core.spec +++ b/tests/python-flit-core.spec @@ -3,7 +3,7 @@ Version: 3.0.0 Release: 0%{?dist} Summary: Distribution-building parts of Flit -License: BSD +License: BSD-3-Clause AND BSD-2-Clause URL: https://pypi.org/project/flit-core/ Source0: https://github.com/takluyver/flit/archive/%{version}/flit-%{version}.tar.gz diff --git a/tests/python-ipykernel.spec b/tests/python-ipykernel.spec index 85edb00..bb0bba8 100644 --- a/tests/python-ipykernel.spec +++ b/tests/python-ipykernel.spec @@ -2,7 +2,7 @@ Name: python-ipykernel Version: 6.11.0 Release: 0%{?dist} Summary: IPython Kernel for Jupyter -License: BSD +License: BSD-3-Clause URL: https://github.com/ipython/ipykernel Source0: https://github.com/ipython/ipykernel/archive/v%{version}/ipykernel-%{version}.tar.gz diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index 6327f8c..9e7c593 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -1,7 +1,7 @@ Name: python-ldap Version: 3.3.0 Release: 0%{?dist} -License: Python +License: python-ldap Summary: An object-oriented API to access LDAP directory servers Source0: %{pypi_source} diff --git a/tests/python-markupsafe.spec b/tests/python-markupsafe.spec index 756d508..95df1ec 100644 --- a/tests/python-markupsafe.spec +++ b/tests/python-markupsafe.spec @@ -2,7 +2,7 @@ Name: python-markupsafe Version: 2.0.1 Release: 0%{?dist} Summary: Implements a XML/HTML/XHTML Markup safe string for Python -License: BSD +License: BSD-3-Clause URL: https://github.com/pallets/markupsafe Source0: %{url}/archive/%{version}/MarkupSafe-%{version}.tar.gz diff --git a/tests/python-mistune.spec b/tests/python-mistune.spec index 94f0c5a..e91ebc1 100644 --- a/tests/python-mistune.spec +++ b/tests/python-mistune.spec @@ -3,7 +3,7 @@ Version: 0.8.3 Release: 11%{?dist} Summary: Markdown parser for Python -License: BSD +License: BSD-3-Clause URL: https://github.com/lepture/mistune Source0: %{url}/archive/v%{version}.tar.gz diff --git a/tests/python-openqa_client.spec b/tests/python-openqa_client.spec index ef6ac46..c444664 100644 --- a/tests/python-openqa_client.spec +++ b/tests/python-openqa_client.spec @@ -4,7 +4,7 @@ Version: 4.0.0 Release: 1%{?dist} Summary: Python client library for openQA API -License: GPLv2+ +License: GPL-2.0-or-later URL: https://github.com/os-autoinst/openQA-python-client Source0: %{pypi_source} diff --git a/tests/python-setuptools.spec b/tests/python-setuptools.spec index fbc554b..4a34766 100644 --- a/tests/python-setuptools.spec +++ b/tests/python-setuptools.spec @@ -9,7 +9,7 @@ Version: 59.6.0 Release: 0%{?dist} Summary: Easily build and distribute Python packages # see the real Fedora package for explanation: -License: MIT and (BSD or ASL 2.0) +License: MIT AND (BSD-2-Clause OR Apache-2.0) URL: https://pypi.python.org/pypi/setuptools Source: %{pypi_source setuptools %{version}} diff --git a/tests/python-zope-event.spec b/tests/python-zope-event.spec index 4a5d4dd..0fb3b24 100644 --- a/tests/python-zope-event.spec +++ b/tests/python-zope-event.spec @@ -2,7 +2,7 @@ Name: python-zope-event Version: 4.2.0 Release: 0%{?dist} Summary: Zope Event Publication -License: ZPLv2.1 +License: ZPL-2.1 URL: https://pypi.python.org/pypi/zope.event/ Source0: %{pypi_source zope.event} BuildArch: noarch From b2862d315fcd9244dae83c01df3f3c099e235227 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 27 Feb 2025 13:44:24 +0100 Subject: [PATCH 10/34] PEP 639 is now accepted, remove the note about its provisional status --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 8e2dd5d..91a759d 100644 --- a/README.md +++ b/README.md @@ -300,7 +300,6 @@ Otherwise, at least one module-glob argument is required. `%pyproject_save_files` can automatically mark license files with `%license` macro and language (`*.mo`) files with `%lang` macro and appropriate language code. Only license files declared via [PEP 639] `License-File` field are detected. -[PEP 639] is still provisional and can be changed in the future. It is possible to use the `-l` flag to declare that a missing license should terminate the build or `-L` (the default) to explicitly disable this check. Packagers are encouraged to use the `-l` flag when the `%license` file is not manually listed in `%files` From caad857e1ab50ce63df9b74e8f0715d3349f271b Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Thu, 6 Mar 2025 18:25:23 +0100 Subject: [PATCH 11/34] Mention ELN/CentOS Stream version needed for the Declarative Build System --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91a759d..9837f01 100644 --- a/README.md +++ b/README.md @@ -402,7 +402,7 @@ Provisional: Declarative Buildsystem (RPM 4.20+) It is possible to reduce some of the spec boilerplate by using the provided pyproject [declarative buildsystem]. -This option is only available with RPM 4.20+ (e.g. in Fedora 41+). +This option is only available with RPM 4.20+ (e.g. in Fedora 41+, ELN/CentOS Stream 11+). The declarative buildsystem is **provisional** and the behavior might change. Please subscribe to Fedora's [python-devel list] if you use the feature. From e9f7ceb420fa695822ad8a367d4d11f2d4e0bf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 13 Mar 2025 10:32:38 +0100 Subject: [PATCH 12/34] CI: Update the tested pluggy Fedora 43 no longer has pytest 7. --- tests/python-pluggy.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/python-pluggy.spec b/tests/python-pluggy.spec index 002b28d..52499e2 100644 --- a/tests/python-pluggy.spec +++ b/tests/python-pluggy.spec @@ -1,6 +1,6 @@ %global pypi_name pluggy Name: python-%{pypi_name} -Version: 0.13.0 +Version: 1.5.0 Release: 1%{?dist} Summary: The plugin manager stripped of pytest specific details @@ -30,9 +30,6 @@ Summary: %{summary} %prep %autosetup -p1 -n %{pypi_name}-%{version} -# Avoid pytest 8 for now. -# Once the compat package is removed from Fedora, we will update pluggy. -sed -i 's/{env:_PYTEST_DEP:pytest}$/{env:_PYTEST_DEP:pytest<8}/' tox.ini %generate_buildrequires From d1c632d76ce0203fe266f8517573bf6c2240b781 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Sat, 15 Mar 2025 13:47:21 +0100 Subject: [PATCH 13/34] Make dependencies in test_data order-independent When updating setuptools from 74 to 76, order of extras has changed. The order of the output is not considered stable and does not need to be asserted. --- test_pyproject_buildrequires.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_pyproject_buildrequires.py b/test_pyproject_buildrequires.py index 815c916..d6f9852 100644 --- a/test_pyproject_buildrequires.py +++ b/test_pyproject_buildrequires.py @@ -102,15 +102,15 @@ def test_data(case_name, capfd, tmp_path, monkeypatch): assert 'expected' in case or 'stderr_contains' in case out, err = capfd.readouterr() - dependencies = output.read_text() + dependencies = sorted(output.read_text().splitlines()) if 'expected' in case: expected = case['expected'] if isinstance(expected, list): # at least one of them needs to match - assert dependencies in expected + assert dependencies in [sorted(e.splitlines()) for e in expected] else: - assert dependencies == expected + assert dependencies == sorted(expected.splitlines()) # stderr_contains may be a string or list of strings stderr_contains = case.get('stderr_contains') From d3dfd5fdb251774036ac5c27b6520fe57efc7191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 11 Mar 2025 17:20:37 +0100 Subject: [PATCH 14/34] Make %pyproject_buildrequires -t/-e and %tox fail when no suitable tox configuration exists Since tox 4, tox does not fail without configuration (tox.ini, or tox section in setup.cfg/pyproject.toml). As a result, packages that use %pyproject_buildrequires with -t or -e without having a tox confuration only generate additional BuildRequires on tox & tox-current-env itself. More dangerously, %tox without tox configuration does nothing (and succeeds). This behavior is dangerous and warrants an announced breakage. Packagers of ~100 affected Fedora packages were informed about the problem earlier in https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/ZSHSHZKVA4XJQBJD7FMMCALKN4UP5SAJ/ There will be a further announcement and warning about this change. EPEL 9 packages are not affected, EPEL 9 has tox 3 which fails without config by default. The change used a newly added option for tox-current-env: --assert-config. This was added in tox-current-env 0.0.16: https://github.com/fedora-python/tox-current-env/pull/89 --- README.md | 2 +- macros.pyproject | 2 +- pyproject-rpm-macros.spec | 8 +++-- pyproject_buildrequires.py | 3 +- pyproject_buildrequires_testcases.yaml | 46 +++++++++++++------------- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9837f01..7b5b21c 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ The macro: - Always prepends `$PATH` with `%{buildroot}%{_bindir}` - If not defined, sets `$PYTHONPATH` to `%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}` - If not defined, sets `$TOX_TESTENV_PASSENV` to `*` - - Runs `tox` with `-q` (quiet), `--recreate` and `--current-env` (from [tox-current-env]) flags + - Runs `tox` with `-q` (quiet), `--recreate`, `--current-env` (from [tox-current-env]) and `--assert-config` (from [tox-current-env]) flags - Implicitly uses the tox environment name stored in `%{toxenv}` - as overridden by `%pyproject_buildrequires -e` By using the `-e` flag, you can use a different tox environment(s): diff --git a/macros.pyproject b/macros.pyproject index e5aedd9..4306b9e 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -234,7 +234,7 @@ PATH="%{buildroot}%{_bindir}:$PATH" \\ PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \\ %{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"}} \\ HOSTNAME="rpmbuild" \\ -%{__python3} -m tox --current-env -q --recreate -e "%{-e:%{-e*}}%{!-e:%{toxenv}}" %{?*} +%{__python3} -m tox --current-env --assert-config -q --recreate -e "%{-e:%{-e*}}%{!-e:%{toxenv}}" %{?*} } diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 3b05197..2ac1416 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.17.0 +Version: 1.18.0 Release: 1%{?dist} # Macro files @@ -59,7 +59,7 @@ BuildRequires: python3dist(packaging) BuildRequires: python3dist(pip) BuildRequires: python3dist(setuptools) %if %{with tox_tests} -BuildRequires: python3dist(tox-current-env) >= 0.0.6 +BuildRequires: python3dist(tox-current-env) >= 0.0.16 %endif BuildRequires: python3dist(wheel) BuildRequires: (python3dist(tomli) if python3 < 3.11) @@ -167,6 +167,10 @@ 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 +- Requires tox-current-env >= 0.0.16 + * Thu Jan 30 2025 Miro Hrončok - 1.17.0-1 - Add the -M flag to %%pyproject_save_files - The flag can be used to indicate no Python modules should be saved diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index da8a239..2bda7cd 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -416,7 +416,7 @@ def generate_run_requirements(backend, requirements, *, build_wheel, read_pyproj def generate_tox_requirements(toxenv, requirements): toxenv = ','.join(toxenv) - requirements.add('tox-current-env >= 0.0.6', source='tox itself') + requirements.add('tox-current-env >= 0.0.16', source='tox itself') requirements.check(source='tox itself') with tempfile.NamedTemporaryFile('r') as deps, \ tempfile.NamedTemporaryFile('r') as extras, \ @@ -426,6 +426,7 @@ def generate_tox_requirements(toxenv, requirements): '--print-deps-to', deps.name, '--print-extras-to', extras.name, '--no-provision', provision.name, + '--assert-config', '-q', '-r', '-e', toxenv], check=False, encoding='utf-8', diff --git a/pyproject_buildrequires_testcases.yaml b/pyproject_buildrequires_testcases.yaml index a374fa0..bfbb5bd 100644 --- a/pyproject_buildrequires_testcases.yaml +++ b/pyproject_buildrequires_testcases.yaml @@ -456,7 +456,7 @@ tox dependencies: setuptools: 50 wheel: 1 tox: 3.5.3 - tox-current-env: 0.0.6 + tox-current-env: 0.0.16 toxenv: - py3 setup.py: | @@ -479,13 +479,13 @@ tox dependencies: - | # tox 3 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(toxdep1) python3dist(toxdep2) python3dist(inst) - | # tox 4 with setuptools 70+ python3dist(setuptools) >= 40.8 - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) python3dist(toxdep1) python3dist(toxdep2) @@ -493,7 +493,7 @@ tox dependencies: - | # tox 4 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) python3dist(toxdep1) python3dist(toxdep2) @@ -505,7 +505,7 @@ tox extras: setuptools: 50 wheel: 1 tox: 3.5.3 - tox-current-env: 0.0.6 + tox-current-env: 0.0.16 generate_extras: true toxenv: - py3 @@ -536,7 +536,7 @@ tox extras: - | # tox 3 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(toxdep) python3dist(inst) python3dist(dep11) > 11.0 @@ -548,7 +548,7 @@ tox extras: python3dist(extra-dep[extra_dep]) - | # tox 4 with setuptools 70+ python3dist(setuptools) >= 40.8 - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) python3dist(toxdep) python3dist(inst) @@ -562,7 +562,7 @@ tox extras: - | # tox 4 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) python3dist(toxdep) python3dist(inst) @@ -580,7 +580,7 @@ tox provision unsatisfied: setuptools: 50 wheel: 1 tox: 3.5.3 - tox-current-env: 0.0.6 + tox-current-env: 0.0.16 toxenv: - py3 setup.py: | @@ -604,13 +604,13 @@ tox provision unsatisfied: - | # tox 3 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) >= 3.999 python3dist(setuptools) > 40.0 python3dist(wheel) > 2.0 - | # tox 4 with setuptools 70+ python3dist(setuptools) >= 40.8 - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) >= 3.999 python3dist(setuptools) > 40.0 python3dist(wheel) > 2.0 @@ -618,7 +618,7 @@ tox provision unsatisfied: - | # tox 4 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) >= 3.999 python3dist(setuptools) > 40.0 python3dist(wheel) > 2.0 @@ -630,7 +630,7 @@ tox provision satisfied: setuptools: 50 wheel: 1 tox: 3.5.3 - tox-current-env: 0.0.6 + tox-current-env: 0.0.16 toxenv: - py3 setup.py: | @@ -653,7 +653,7 @@ tox provision satisfied: - | # tox 3 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) >= 3.5 python3dist(setuptools) > 40.0 python3dist(toxdep1) @@ -661,7 +661,7 @@ tox provision satisfied: python3dist(inst) - | # tox 4 with setuptools 70+ python3dist(setuptools) >= 40.8 - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(setuptools) > 40.0 python3dist(tox) >= 3.5 python3dist(toxdep1) @@ -670,7 +670,7 @@ tox provision satisfied: - | # tox 4 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(setuptools) > 40.0 python3dist(tox) >= 3.5 python3dist(toxdep1) @@ -683,7 +683,7 @@ tox provision no minversion: setuptools: 50 wheel: 1 tox: 3.5.3 - tox-current-env: 0.0.6 + tox-current-env: 0.0.16 toxenv: - py3 setup.py: | @@ -701,19 +701,19 @@ tox provision no minversion: - | # tox 3 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(setuptools) > 40.0 python3dist(wheel) > 2.0 - | # tox 4 with setuptools 70+ python3dist(setuptools) >= 40.8 - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(setuptools) > 40.0 python3dist(wheel) > 2.0 python3dist(tox) - | # tox 4 with setuptools < 70 python3dist(setuptools) >= 40.8 python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(setuptools) > 40.0 python3dist(wheel) > 2.0 python3dist(tox) @@ -1573,7 +1573,7 @@ tox with dependency_groups: setuptools: 50 wheel: 1 tox: 4.22 - tox-current-env: 0.0.14 + tox-current-env: 0.0.16 toxenv: - py3 pyproject.toml: | @@ -1594,7 +1594,7 @@ tox with dependency_groups: expected: - | # setuptools 70+ python3dist(setuptools) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) >= 4.22 python3dist(tox) python3dist(pytest) >= 5 @@ -1602,7 +1602,7 @@ tox with dependency_groups: - | # setuptools < 70 python3dist(setuptools) python3dist(wheel) - python3dist(tox-current-env) >= 0.0.6 + python3dist(tox-current-env) >= 0.0.16 python3dist(tox) >= 4.22 python3dist(tox) python3dist(pytest) >= 5 From fb7bcbb06854ae4cc358298b92165ab6133e73ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 14 Mar 2025 12:35:49 +0100 Subject: [PATCH 15/34] Allow %pyproject_buildrequires -t/-e without tox config on Fedora 40-42 This still does not allow %tox without tox config. --- macros.pyproject | 2 +- pyproject-rpm-macros.spec | 1 + pyproject_buildrequires.py | 11 ++++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) 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 2ac1416..fa08251 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -169,6 +169,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', From c1326723a9ecc2abfa8f7b2cc8ddf35b55d94215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 21 Mar 2025 14:49:58 +0100 Subject: [PATCH 16/34] Fix reverted conditional in %pyproject_buildrequires -t/-e Fedora version comparison --- pyproject-rpm-macros.spec | 5 ++++- pyproject_buildrequires.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index fa08251..d4bf496 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.18.0 +Version: 1.18.1 Release: 1%{?dist} # Macro files @@ -167,6 +167,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Fri Mar 21 2025 Miro Hrončok - 1.18.1-1 +- Fix reverted conditional in %%pyproject_buildrequires -t/-e Fedora version comparison + * 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 diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index d90cf1e..4ed7950 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -29,7 +29,7 @@ VERSION_RE = re.compile(r'[a-zA-Z0-9.-]+(\.\*)?') # 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 () +TOX_ASSERT_CONFIG_OPTS = () if 40 <= FEDORA < 43 else ('--assert-config',) class EndPass(Exception): From 5e1a6e91f0b35d66188040acfa9e89e8ff9c339c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 11 Apr 2025 19:23:18 +0200 Subject: [PATCH 17/34] Update comment wrt setuptools not putting licenses in licenses/ directory --- pyproject_save_files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject_save_files.py b/pyproject_save_files.py index dd6b05c..73d0996 100644 --- a/pyproject_save_files.py +++ b/pyproject_save_files.py @@ -357,7 +357,7 @@ def classify_paths( license_files = metadata.get_all('License-File') license_directory = distinfo / 'licenses' # See PEP 639 "Root License Directory" # setuptools was the first known build backend to implement License-File. - # Unfortunately they don't put licenses to the license directory (yet): + # Unfortunately they didn't put licenses to the license directory in setuptools<78: # https://github.com/pypa/setuptools/issues/3596 # Hence, we check licenses in both licenses and dist-info license_directories = (license_directory, distinfo) From fc9cfbe36001b02286bac50137d50ec27bb2d519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 11 Apr 2025 21:05:34 +0200 Subject: [PATCH 18/34] CI: Adjust for normalized dist-info names with new setuptools --- tests/double-install.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/double-install.spec b/tests/double-install.spec index b1ea68b..e837dee 100644 --- a/tests/double-install.spec +++ b/tests/double-install.spec @@ -61,5 +61,5 @@ cd .. %{_bindir}/tldr* %pycached %{python3_sitelib}/tldr.py %{python3_sitelib}/tldr-%{tldr_version}.dist-info/ -%{python3_sitearch}/MarkupSafe-%{markupsafe_version}.dist-info/ +%{python3_sitearch}/[Mm]arkup[Ss]afe-%{markupsafe_version}.dist-info/ %{python3_sitearch}/markupsafe/ From be0ace6df6956a3a1b1f196f26b3d0ad2f79df93 Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Sun, 20 Apr 2025 06:15:02 +0000 Subject: [PATCH 19/34] Mark Qt language files Ensure translation files used in PyQt projects get marked as such. --- pyproject_save_files.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject_save_files.py b/pyproject_save_files.py index 73d0996..0a831e8 100644 --- a/pyproject_save_files.py +++ b/pyproject_save_files.py @@ -348,7 +348,7 @@ def classify_paths( "docs": [], # to be used once there is upstream way to recognize READMEs "licenses": [], # %license entries parsed from dist-info METADATA file }, - "lang": {}, # %lang entries: [module_name or None][language_code] lists of .mo files + "lang": {}, # %lang entries: [module_name or None][language_code] lists of .mo and .qm files "modules": defaultdict(list), # each importable module (directory, .py, .so) "module_names": set(), # qualified names of each importable module ("foo.bar.baz") "other": {"files": []}, # regular %file entries we could not parse :( @@ -412,7 +412,7 @@ def classify_paths( for parent in list(path.parents)[:index]: # no direct slice until Python 3.10 add_file_to_module(paths, module_dir.name, "package", "dirs", parent) is_lang = False - if path.suffix == ".mo": + if path.suffix == ".mo" or path.suffix == ".qm": is_lang = add_lang_to_module(paths, module_dir.name, path) if not is_lang: if path.suffix == ".py": @@ -425,7 +425,7 @@ def classify_paths( add_file_to_module(paths, module_dir.name, "package", "files", path) break else: - if path.suffix == ".mo": + if path.suffix == ".mo" or path.suffix == ".qm": add_lang_to_module(paths, None, path) or paths["other"]["files"].append(path) else: path = normalize_manpage_filename(prefix, path) From 570b5a6ee6015c9cdb86f649b9dbdac93a0c4531 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Mon, 19 May 2025 16:47:47 -0500 Subject: [PATCH 20/34] pyproject_buildrequires: don't pass config_settings as kwarg PEP 517 says that the argument should be named config_settings but pip/pyproject-hooks and other build frontends just pass it as a positional argument, so some build backends name this argument other things. Even though those build backends are wrong, it still makes sense to align pyproject-rpm-macros with what the other frontends do. Ref: https://github.com/PyO3/maturin/pull/2612 Ref: https://github.com/Rogdham/pyzstd/pull/2 --- pyproject-rpm-macros.spec | 5 ++++- pyproject_buildrequires.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index d4bf496..5cbd9ce 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.18.1 +Version: 1.18.2 Release: 1%{?dist} # Macro files @@ -167,6 +167,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Mon May 19 2025 Maxwell G - 1.18.2-1 +- Fix handling of config_settings in %%pyproject_buildrequires + * Fri Mar 21 2025 Miro Hrončok - 1.18.1-1 - Fix reverted conditional in %%pyproject_buildrequires -t/-e Fedora version comparison diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index 4ed7950..f4c38ab 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -299,7 +299,7 @@ def get_backend(requirements): def generate_build_requirements(backend, requirements): get_requires = getattr(backend, 'get_requires_for_build_wheel', None) if get_requires: - new_reqs = get_requires(config_settings=requirements.config_settings) + new_reqs = get_requires(requirements.config_settings) requirements.extend(new_reqs, source='get_requires_for_build_wheel') requirements.check(source='get_requires_for_build_wheel') @@ -334,7 +334,7 @@ def generate_run_requirements_hook(backend, requirements): 'table, you can use the -p flag to read them. ' 'Alternatively, use the -R flag not to generate runtime dependencies.' ) - dir_basename = prepare_metadata('.', config_settings=requirements.config_settings) + dir_basename = prepare_metadata('.', requirements.config_settings) with open(dir_basename + '/METADATA') as metadata_file: name, requires = package_name_and_requires_from_metadata_file(metadata_file) for key, req in requires.items(): From 38866ffe8790bed86f741ee24fb56bead9f4d803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 20 Jun 2025 13:36:01 +0200 Subject: [PATCH 21/34] CI: Update tested pytest to fix build with Python 3.14 We got: DEBUG: File "/builddir/build/BUILD/python-pytest-7.2.0-build/BUILDROOT/usr/lib/python3.14/site-packages/_pytest/assertion/rewrite.py", line 670, in run DEBUG: and isinstance(item.value, ast.Str) DEBUG: ^^^^^^^ DEBUG: AttributeError: module 'ast' has no attribute 'Str' Version 8.0.2 builds in Fedora 43, 42, 41, EPEL 10 (still without tests). The setup.py manipulation was moved to pluggy, as pytest 8 no longer has setup.py. --- tests/python-pluggy.spec | 3 +++ tests/python-pytest.spec | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/python-pluggy.spec b/tests/python-pluggy.spec index 52499e2..e2fee25 100644 --- a/tests/python-pluggy.spec +++ b/tests/python-pluggy.spec @@ -30,6 +30,9 @@ Summary: %{summary} %prep %autosetup -p1 -n %{pypi_name}-%{version} +# internal check for our macros: insert a subprocess echo to setup.py +# to ensure it's not generated as BuildRequires +echo 'import os; os.system("echo if-this-is-generated-the-build-will-fail")' >> setup.py %generate_buildrequires diff --git a/tests/python-pytest.spec b/tests/python-pytest.spec index 308479c..49f0b42 100644 --- a/tests/python-pytest.spec +++ b/tests/python-pytest.spec @@ -1,6 +1,6 @@ %global pypi_name pytest Name: python-%{pypi_name} -Version: 7.2.0 +Version: 8.0.2 Release: 0%{?dist} Summary: Simple powerful testing with Python License: MIT @@ -20,7 +20,7 @@ BuildRequires: pyproject-rpm-macros %description This is a pure Python package with executables. It has a test suite in tox.ini -and test dependencies specified via the [test] extra. +and test dependencies specified via the [testing] extra. Building this tests: - generating runtime and test dependencies by both tox.ini and extras - pyproject.toml with the setuptools backend and setuptools-scm @@ -37,9 +37,6 @@ Summary: %{summary} %autosetup -p1 -n %{pypi_name}-%{version} # remove optional test dependencies we don't like to pull in sed -E -i '/mock|nose/d' setup.cfg -# internal check for our macros: insert a subprocess echo to setup.py -# to ensure it's not generated as BuildRequires -echo 'import os; os.system("echo if-this-is-generated-the-build-will-fail")' >> setup.py %generate_buildrequires From f0b3a0b8601532f46bace61a9703fd328f48db60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 10 Jul 2025 11:07:05 +0200 Subject: [PATCH 22/34] Avoid non-fatal errors in %pyproject_install with multiple wheels Use double quotes around a shell variable that may contain spaces. There were errors like: + '[' -z markupsafe==2.0.1 tldr==0.4.4 ']' /var/tmp/rpm-tmp.v6rA4u: line 55: [: markupsafe==2.0.1: binary operator expected Or: + '[' -z nemo_audio_tab==6.4.0 nemo_compare==6.4.0 nemo_emblems==6.4.0 nemo_pastebin==6.4.0 nemo_terminal==6.4.0 ']' /var/tmp/rpm-tmp.BD4qxp: line 53: [: too many arguments But considering the exit code of [ was non-zero, the built continued. --- macros.pyproject | 2 +- tests/double-install.spec | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/macros.pyproject b/macros.pyproject index 6709fe9..7ef6279 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -75,7 +75,7 @@ echo $(IFS=:; echo "${pyproject_build_lib[*]}") %pyproject_install() %{expand:\\\ specifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/') -if [ -z $specifier ]; then +if [ -z "$specifier" ]; then echo 'ERROR: %%%%pyproject_install found no wheel in %%%%{_pyproject_wheeldir} %{_pyproject_wheeldir}' >&2 exit 1 fi diff --git a/tests/double-install.spec b/tests/double-install.spec index e837dee..bda1956 100644 --- a/tests/double-install.spec +++ b/tests/double-install.spec @@ -39,8 +39,10 @@ cd .. %install +( # This should install both the wheels: %pyproject_install +) 2>&1 | tee install.log #pyproject_save_files is not possible with 2 dist-infos @@ -55,6 +57,9 @@ test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/markupsafe-%{marku cd ../tldr-%{tldr_version} test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/tldr-%{tldr_version}/build/lib" cd .. +# Internal regression check for %%pyproject_install with multiple wheels +grep 'binary operator expected' install.log && exit 1 || true +grep 'too many arguments' install.log && exit 1 || true %files From a4e0e043445f5cd08aa389e1cffca8afc56196d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 11 Jul 2025 12:24:36 +0200 Subject: [PATCH 23/34] %pyproject_buildrequires: Do not generate BuildRequires from Requires core metadata fields See https://packaging.python.org/en/latest/specifications/core-metadata/#requires That field is deprecated and should include importable module names, not distribution packages. We have no RPM Provides for importable names. Treating this like python3dist() Requires is wrong and may result in stuff like: No match for argument: python3dist(pkg-resources) For packages using python-distutils-extra. See https://bugzilla.redhat.com/show_bug.cgi?id=2378463#c2 This bug existed from the very beginning of the %pyproject_buildrequires, but the field is almost unused in real packages, so it was not noticed until we asked all Python packages to be ported to the new macros. --- I considered flattening the structure returned from requires_from_parsed_metadata_file, but then we would need to hardcode "Requires-Dist" in various source= declarations, so I kept the structure as is. --- pyproject-rpm-macros.spec | 7 ++++++- pyproject_buildrequires.py | 2 +- pyproject_buildrequires_testcases.yaml | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 5cbd9ce..a689107 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.18.2 +Version: 1.18.3 Release: 1%{?dist} # Macro files @@ -167,6 +167,11 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Fri Jul 11 2025 Miro Hrončok - 1.18.3-1 +- %%pyproject_buildrequires: Do not generate BuildRequires from Requires core metadata fields +- That field is deprecated and should include importable module names, not distribution packages +- Related: rhbz#2378463 + * Mon May 19 2025 Maxwell G - 1.18.2-1 - Fix handling of config_settings in %%pyproject_buildrequires diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index f4c38ab..bba4f00 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -309,7 +309,7 @@ def parse_metadata_file(metadata_file): def requires_from_parsed_metadata_file(message): - return {k: message.get_all(k, ()) for k in ('Requires', 'Requires-Dist')} + return {k: message.get_all(k, ()) for k in ('Requires-Dist',)} def package_name_from_parsed_metadata_file(message): diff --git a/pyproject_buildrequires_testcases.yaml b/pyproject_buildrequires_testcases.yaml index bfbb5bd..ae26569 100644 --- a/pyproject_buildrequires_testcases.yaml +++ b/pyproject_buildrequires_testcases.yaml @@ -1608,3 +1608,23 @@ tox with dependency_groups: python3dist(pytest) >= 5 python3dist(pytest-mock) result: 0 + +Plain Requires fields in core metadata is ignored: + installed: + setuptools: 50 + wheel: 1 + include_runtime: true + setup.py: | + from setuptools import setup + setup( + name='test', + version='0.1', + requires=['ignore_me'], + ) + expected: + - | # setuptools 70+ + python3dist(setuptools) >= 40.8 + - | # setuptools < 70 + python3dist(setuptools) >= 40.8 + python3dist(wheel) + result: 0 From 1a867b5ab79a57d4207b423d0c2e36d9df2283bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 24 Jul 2025 00:01:34 +0200 Subject: [PATCH 24/34] Only BuildRequire wheel when setuptools < 71 --- pyproject-rpm-macros.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index a689107..9d61299 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -61,7 +61,7 @@ BuildRequires: python3dist(setuptools) %if %{with tox_tests} BuildRequires: python3dist(tox-current-env) >= 0.0.16 %endif -BuildRequires: python3dist(wheel) +BuildRequires: (python3dist(wheel) if python3dist(setuptools) < 71) BuildRequires: (python3dist(tomli) if python3 < 3.11) %endif From 3feea218e7bbad60ac91ef1aab0cdfda923e3d88 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 06:23:37 +0000 Subject: [PATCH 25/34] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- pyproject-rpm-macros.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 9d61299..44e179a 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -15,7 +15,7 @@ License: MIT # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change Version: 1.18.3 -Release: 1%{?dist} +Release: 2%{?dist} # Macro files Source001: macros.pyproject @@ -167,6 +167,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 1.18.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Fri Jul 11 2025 Miro Hrončok - 1.18.3-1 - %%pyproject_buildrequires: Do not generate BuildRequires from Requires core metadata fields - That field is deprecated and should include importable module names, not distribution packages From 8998e8e0277f857f33a985ce938cb3616bb2779e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Mon, 28 Jul 2025 17:09:27 +0200 Subject: [PATCH 26/34] CI: Respect TEST_ARTIFACTS but detect tmt STI used to allow /tmp/artifacts, in tmt we have TMT_PLAN_DATA and TMT_TEST_DATA. Use the later, which is test specific. --- tests/mocktest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mocktest.sh b/tests/mocktest.sh index 9cfad81..15fc9f3 100755 --- a/tests/mocktest.sh +++ b/tests/mocktest.sh @@ -72,7 +72,7 @@ mock --verbose --isolation=simple -r $config --enablerepo="$repos" init mock --verbose --isolation=simple -r $config --enablerepo="$repos" "$@" ~/rpmbuild/SRPMS/${pkgname}-*.src.rpm || res=$? # move the results to the artifacts directory, so we can examine them -artifacts=${TEST_ARTIFACTS:-/tmp/artifacts} +artifacts=${TEST_ARTIFACTS:-${TMT_TEST_DATA:-/tmp/artifacts}} # on Fedora Rawhide, the directory contains "rawhide" instead of the actual version pushd /var/lib/mock/${mock}/result || pushd /var/lib/mock/${mock/${version}/rawhide}/result From 84e6d30255275c6d3632bb926c0fd47058787643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Fri, 25 Jul 2025 10:44:47 +0200 Subject: [PATCH 27/34] CI: Drop STI and use tmt Resolves: rhbz#2383022 --- .fmf/version | 1 + plan.fmf | 116 +++++++++++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 118 ------------------------------------------------ 3 files changed, 117 insertions(+), 118 deletions(-) create mode 100644 .fmf/version create mode 100644 plan.fmf delete mode 100644 tests/tests.yml diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..0c65ffb --- /dev/null +++ b/plan.fmf @@ -0,0 +1,116 @@ +execute: + how: tmt +discover: + - name: same_repo + how: shell + tests: + - name: pytest + path: /tests + test: ./mocktest.sh python-pytest + - name: entrypoints + path: /tests + test: ./mocktest.sh python-entrypoints + - name: pluggy + path: /tests + test: ./mocktest.sh python-pluggy + - name: clikit + path: /tests + test: ./mocktest.sh python-clikit + - name: distroinfo + path: /tests + test: ./mocktest.sh python-distroinfo + - name: tldr + path: /tests + test: ./mocktest.sh tldr + - name: openqa_client + path: /tests + test: ./mocktest.sh python-openqa_client + - name: httpbin + path: /tests + test: ./mocktest.sh python-httpbin + - name: ldap + path: /tests + test: ./mocktest.sh python-ldap + - name: isort + path: /tests + test: ./mocktest.sh python-isort + - name: mistune + path: /tests + test: ./mocktest.sh python-mistune + - name: setuptools_scm + path: /tests + test: ./mocktest.sh python-setuptools_scm + - name: ipykernel + path: /tests + test: ./mocktest.sh python-ipykernel + - name: zope + path: /tests + test: ./mocktest.sh python-zope-event + - name: django + path: /tests + test: ./mocktest.sh python-django + - name: printrun + path: /tests + test: ./mocktest.sh printrun + - name: dns_lexicon + path: /tests + test: ./mocktest.sh python-dns-lexicon + - name: flit_core + path: /tests + test: ./mocktest.sh python-flit-core + - name: poetry_core + path: /tests + test: ./mocktest.sh python-poetry-core + - name: setuptools + path: /tests + test: ./mocktest.sh python-setuptools + - name: markupsafe + path: /tests + test: ./mocktest.sh python-markupsafe + - name: getmac + path: /tests + test: ./mocktest.sh python-getmac + - name: userpath + path: /tests + test: ./mocktest.sh python-userpath + - name: markdown_it_py + path: /tests + test: ./mocktest.sh python-markdown-it-py + - name: double_install + path: /tests + test: ./mocktest.sh double-install + - name: fake_requirements + path: /tests + test: ./mocktest.sh fake-requirements + - name: virtualenv + path: /tests + test: ./mocktest.sh python-virtualenv + - name: coverage_pth + path: /tests + test: ./mocktest.sh python-coverage-pth + - name: pello + path: /tests + test: ./mocktest.sh python-pello + - name: pello_with_options + path: /tests + test: ./mocktest.sh python-pello --with options + - name: escape_paths + path: /tests + test: ./mocktest.sh escape_paths + - name: config-settings-test + path: /tests + test: ./mocktest.sh config-settings-test + - name: isort_c9s + path: /tests + test: NAME="CentOS Stream" VERSION_ID=9 ./mocktest.sh python-isort +prepare: + - name: Install dependencies + how: install + package: + - mock + - rpmdevtools + - rpm-build + - dnf + - name: Update packages + how: shell + script: dnf upgrade -y diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 3fbff89..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,118 +0,0 @@ ---- -- hosts: localhost - tags: - - classic - tasks: - - dnf: - name: "*" - state: latest - -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - tests: - - pytest: - dir: . - run: ./mocktest.sh python-pytest - - entrypoints: - dir: . - run: ./mocktest.sh python-entrypoints - - pluggy: - dir: . - run: ./mocktest.sh python-pluggy - - clikit: - dir: . - run: ./mocktest.sh python-clikit - - distroinfo: - dir: . - run: ./mocktest.sh python-distroinfo - - tldr: - dir: . - run: ./mocktest.sh tldr - - openqa_client: - dir: . - run: ./mocktest.sh python-openqa_client - - httpbin: - dir: . - run: ./mocktest.sh python-httpbin - - ldap: - dir: . - run: ./mocktest.sh python-ldap - - isort: - dir: . - run: ./mocktest.sh python-isort - - mistune: - dir: . - run: ./mocktest.sh python-mistune - - setuptools_scm: - dir: . - run: ./mocktest.sh python-setuptools_scm - - ipykernel: - dir: . - run: ./mocktest.sh python-ipykernel - - zope: - dir: . - run: ./mocktest.sh python-zope-event - - django: - dir: . - run: ./mocktest.sh python-django - - printrun: - dir: . - run: ./mocktest.sh printrun - - dns_lexicon: - dir: . - run: ./mocktest.sh python-dns-lexicon - - flit_core: - dir: . - run: ./mocktest.sh python-flit-core - - poetry_core: - dir: . - run: ./mocktest.sh python-poetry-core - - setuptools: - dir: . - run: ./mocktest.sh python-setuptools - - markupsafe: - dir: . - run: ./mocktest.sh python-markupsafe - - getmac: - dir: . - run: ./mocktest.sh python-getmac - - userpath: - dir: . - run: ./mocktest.sh python-userpath - - markdown_it_py: - dir: . - run: ./mocktest.sh python-markdown-it-py - - double_install: - dir: . - run: ./mocktest.sh double-install - - fake_requirements: - dir: . - run: ./mocktest.sh fake-requirements - - virtualenv: - dir: . - run: ./mocktest.sh python-virtualenv - - coverage_pth: - dir: . - run: ./mocktest.sh python-coverage-pth - - pello: - dir: . - run: ./mocktest.sh python-pello - - pello_with_options: - dir: . - run: ./mocktest.sh python-pello --with options - - escape_paths: - dir: . - run: ./mocktest.sh escape_paths - - config-settings-test: - dir: . - run: ./mocktest.sh config-settings-test - - isort_c9s: - dir: . - run: NAME="CentOS Stream" VERSION_ID=9 ./mocktest.sh python-isort - required_packages: - - mock - - rpmdevtools - - rpm-build From ea56d1c870dff8de6c94dd43cd719f611803de51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 1 Sep 2025 13:17:43 +0200 Subject: [PATCH 28/34] Don't exit from pyproject-srpm-macros implementation of %pyproject_buildrequires - Fixes: rhbz#2391290 Consider code like this: %generate_buildrequires mv setup.py{,.ignore} %pyproject_buildrequires mv setup.py{.ignore,} When %pyproject_buildrequires exits, the second mv is never executed. The next round of %generate_buildrequires will then fail. In fact, there is probably not a good reason to call exit from %pyproject_buildrequires. From https://src.fedoraproject.org/rpms/libcpuid/pull-request/7 --- macros.aaa-pyproject-srpm | 2 +- pyproject-rpm-macros.spec | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/macros.aaa-pyproject-srpm b/macros.aaa-pyproject-srpm index b394be5..fd4dece 100644 --- a/macros.aaa-pyproject-srpm +++ b/macros.aaa-pyproject-srpm @@ -4,7 +4,7 @@ # this macro will cause the package with the real macro to be installed. # When macros.pyproject is installed, it overrides this macro. # Note: This takes arbitrary options, to ease addition of new options to the real macro. -%pyproject_buildrequires(-) echo 'pyproject-rpm-macros' && exit 0 +%pyproject_buildrequires(-) echo 'pyproject-rpm-macros' # Declarative buildsystem, requires RPM 4.20+ to work diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 44e179a..d544e97 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,8 +14,8 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.18.3 -Release: 2%{?dist} +Version: 1.18.4 +Release: 1%{?dist} # Macro files Source001: macros.pyproject @@ -167,6 +167,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Mon Sep 01 2025 Miro Hrončok - 1.18.4-1 +- Don't exit from pyproject-srpm-macros implementation of %%pyproject_buildrequires +- Fixes: rhbz#2391290 + * Fri Jul 25 2025 Fedora Release Engineering - 1.18.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 3ae687d401a8d8820bb6a04e45ed9f504099c842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 1 Sep 2025 13:32:02 +0200 Subject: [PATCH 29/34] On RPM 4.20+ don't put pyproject-macros-specific files in %buildsubdir - Works around https://github.com/rpm-software-management/rpm/issues/3890 --- macros.pyproject | 10 ++++++++-- plan.fmf | 3 +++ pyproject-rpm-macros.spec | 2 ++ tests/python-pello.spec | 14 +++++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/macros.pyproject b/macros.pyproject index 7ef6279..cf56ef9 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -2,8 +2,14 @@ # For the main Python it's empty, for all others it's "-3.X" %_pyproject_files_pkgversion %{expr:"%{python3_pkgversion}" != "3" ? "-%{python3_pkgversion}" : ""} +# In RPM < 4.20 (4.19.9x is 4.20 alpha), there is no guaranteed, RPM-controlled per-build directory (%%mkbuilddir step). +# Hence we use %%{buildsubdir} if available. +# On newer RPM 4.20+ this is no longer necessary and breaks the declarative buildsystem: +# https://github.com/rpm-software-management/rpm/issues/3890 +%_pyproject_buildsubdir_compat %[ v"0%{?rpmversion}" < v"4.19.90" ? "%{?buildsubdir:/%{buildsubdir}}" : ""] + # This is a directory where wheels are stored and installed from, absolute -%_pyproject_wheeldir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/pyproject-wheeldir%{_pyproject_files_pkgversion} +%_pyproject_wheeldir %{_builddir}%{_pyproject_buildsubdir_compat}/pyproject-wheeldir%{_pyproject_files_pkgversion} # This is a directory used as TMPDIR, where pip copies sources to and builds from, relative to PWD # For proper debugsource packages, we create TMPDIR within PWD @@ -12,7 +18,7 @@ # This will be used in debugsource package paths (applies to extension modules only) # NB: pytest collects tests from here if not hidden # https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs -%_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir%{_pyproject_files_pkgversion} +%_pyproject_builddir %{_builddir}%{_pyproject_buildsubdir_compat}/.pyproject-builddir%{_pyproject_files_pkgversion} # We prefix all created files with this value to make them unique # Ideally, we would put them into %%{buildsubdir}, but that value changes during the spec diff --git a/plan.fmf b/plan.fmf index 0c65ffb..ccb6027 100644 --- a/plan.fmf +++ b/plan.fmf @@ -94,6 +94,9 @@ discover: - name: pello_with_options path: /tests test: ./mocktest.sh python-pello --with options + - name: pello_with_override_install + path: /tests + test: ./mocktest.sh python-pello --with override_install - name: escape_paths path: /tests test: ./mocktest.sh escape_paths diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index d544e97..4920149 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -170,6 +170,8 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 * Mon Sep 01 2025 Miro Hrončok - 1.18.4-1 - Don't exit from pyproject-srpm-macros implementation of %%pyproject_buildrequires - Fixes: rhbz#2391290 +- On RPM 4.20+ don't put pyproject-macros-specific files in %%buildsubdir +- Works around https://github.com/rpm-software-management/rpm/issues/3890 * Fri Jul 25 2025 Fedora Release Engineering - 1.18.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/tests/python-pello.spec b/tests/python-pello.spec index ccc9915..3d4e0ff 100644 --- a/tests/python-pello.spec +++ b/tests/python-pello.spec @@ -9,14 +9,18 @@ Source: %{url}/archive/v%{version}/Pello-%{version}.tar.gz BuildArch: noarch -# we use this specfile for 2 different tests, this bcond controls it +# we use this specfile for various different tests, the bconds controls it # a build --with options tests custom BuildOptions(generate_buildrequires) %bcond options 0 +# a build --with override_install has a custom %%install section +%bcond override_install 0 # unfortunately, the following is not even parsable on RPM < 4.20 %if v"0%{?rpmversion}" >= v"4.19.90" BuildSystem: pyproject +%if %{without override_install} BuildOption(install): -l pello +%endif %if %{with options} BuildOption(generate_buildrequires): -t %endif @@ -44,6 +48,14 @@ Summary: %{summary} %endif +%if %{with override_install} && v"0%{?rpmversion}" >= v"4.19.90" +# to test a fix for https://github.com/rpm-software-management/rpm/issues/3890 +%install +%pyproject_install +%pyproject_save_files -l pello +%endif + + %if v"0%{?rpmversion}" >= v"4.19.90" %files -n python3-pello -f %{pyproject_files} %doc README.md From 4aaa4be87e2746698d6fa574f5e898f0a146118c Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Mon, 1 Sep 2025 18:13:04 +0200 Subject: [PATCH 30/34] Speed %pyproject_save_files up significantly by using sets instead of lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For packages with a lot of files, it took a really long time to run. Profiling the code revealed most of the time is spent in PurePath.__eq__. The code was using lists but checked if to-be-added paths were not already in them. Considering the order is insignificant (the generated %files list is sorted at the end anyway), the lists were essentially working as (very slow) sets. Using sets instead of lists makes %pyproject_save_files over 20 times faster (51.66 -> 2.39 seconds) for the ansible package (~62k files). Checking if an item is in a list is O(N), checking every added item is O(N**2). Checking if an item is in a set is O(1), checking every added item is O(N). Additionally, with set, it is unnecessary to check for presence before addition, so the code is easier. (Commit message and removal of the check by Miro.) Co-Authored-By: Miro Hrončok --- pyproject-rpm-macros.spec | 1 + pyproject_save_files.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 4920149..f8364b5 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -172,6 +172,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 - Fixes: rhbz#2391290 - On RPM 4.20+ don't put pyproject-macros-specific files in %%buildsubdir - Works around https://github.com/rpm-software-management/rpm/issues/3890 +- Speed %%pyproject_save_files up significantly * Fri Jul 25 2025 Fedora Release Engineering - 1.18.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/pyproject_save_files.py b/pyproject_save_files.py index 0a831e8..7ae4193 100644 --- a/pyproject_save_files.py +++ b/pyproject_save_files.py @@ -137,12 +137,11 @@ def add_file_to_module(paths, module_name, module_type, files_dirs, *files): """ for module in paths["modules"][module_name]: if module["type"] == module_type: - if files[0] not in module[files_dirs]: - module[files_dirs].extend(files) + module[files_dirs].update(files) break else: paths["modules"][module_name].append( - {"type": module_type, "files": [], "dirs": [], files_dirs: list(files)} + {"type": module_type, "files": set(), "dirs": set(), files_dirs: set(files)} ) From 8a209c9005a6ea50831f155e33c7c8a236ce5765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 2 Sep 2025 11:56:46 +0200 Subject: [PATCH 31/34] CI: Add Python 3.13 on EPEL 9 and 10 --- plan.fmf | 3 +++ tests/python-isort.spec | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/plan.fmf b/plan.fmf index ccb6027..1b4e82e 100644 --- a/plan.fmf +++ b/plan.fmf @@ -106,6 +106,9 @@ discover: - name: isort_c9s path: /tests test: NAME="CentOS Stream" VERSION_ID=9 ./mocktest.sh python-isort + - name: isort_c10s + path: /tests + test: NAME="CentOS Stream" VERSION_ID=10 ./mocktest.sh python-isort prepare: - name: Install dependencies how: install diff --git a/tests/python-isort.spec b/tests/python-isort.spec index 82956c4..0b300a1 100644 --- a/tests/python-isort.spec +++ b/tests/python-isort.spec @@ -37,6 +37,15 @@ Summary: %{summary} %package -n python%{python3_pkgversion}-%{modname} Summary: %{summary} +%description -n python%{python3_pkgversion}-%{modname} +%{summary}. +%endif + +%if 0%{?rhel} == 9 || 0%{?rhel} == 10 +%global python3_pkgversion 3.13 +%package -n python%{python3_pkgversion}-%{modname} +Summary: %{summary} + %description -n python%{python3_pkgversion}-%{modname} %{summary}. @@ -55,6 +64,10 @@ Summary: %{summary} %pyproject_buildrequires %global python3_pkgversion 3.12 %pyproject_buildrequires +%endif +%if 0%{?rhel} == 9 || 0%{?rhel} == 10 +%global python3_pkgversion 3.13 +%pyproject_buildrequires %global python3_pkgversion 3 %endif @@ -67,6 +80,10 @@ Summary: %{summary} %pyproject_wheel %global python3_pkgversion 3.12 %pyproject_wheel +%endif +%if 0%{?rhel} == 9 || 0%{?rhel} == 10 +%global python3_pkgversion 3.13 +%pyproject_wheel %global python3_pkgversion 3 %endif @@ -79,6 +96,11 @@ Summary: %{summary} %global python3_pkgversion 3.12 %pyproject_install %pyproject_save_files -l isort +%endif +%if 0%{?rhel} == 9 || 0%{?rhel} == 10 +%global python3_pkgversion 3.13 +%pyproject_install +%pyproject_save_files -l isort %global python3_pkgversion 3 %endif # we keep this one last so /usr/bin/isort is installed with python3 shebang @@ -107,6 +129,13 @@ diff %{pyproject_files} <(grep -F python3.11/site-packages %{pyproject_files}) test -d %{buildroot}%{_usr}/lib/python3.12/site-packages/%{modname}/ test -d %{buildroot}%{_usr}/lib/python3.12/site-packages/%{modname}-%{version}.dist-info/ diff %{pyproject_files} <(grep -F python3.12/site-packages %{pyproject_files}) +%endif + +%if 0%{?rhel} == 9 || 0%{?rhel} == 10 +%global python3_pkgversion 3.13 +test -d %{buildroot}%{_usr}/lib/python3.13/site-packages/%{modname}/ +test -d %{buildroot}%{_usr}/lib/python3.13/site-packages/%{modname}-%{version}.dist-info/ +diff %{pyproject_files} <(grep -F python3.13/site-packages %{pyproject_files}) %global python3_pkgversion 3 %endif @@ -121,5 +150,10 @@ diff %{pyproject_files} <(grep -F python3.12/site-packages %{pyproject_files}) %global python3_pkgversion 3.12 %files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files} %doc README.rst *.md +%endif +%if 0%{?rhel} == 9 || 0%{?rhel} == 10 +%global python3_pkgversion 3.13 +%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files} +%doc README.rst *.md %global python3_pkgversion 3 %endif From fbd3dcd22bd1206e3ec066ad8cd0a2eaebf80583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 16 Oct 2025 16:19:19 +0200 Subject: [PATCH 32/34] %pyproject_extras_subpkg: Only %ghost the dist-info directory, not the content That way, accidentally unpackaged files within are reported as errors. Currently, when %pyproject_extras_subpkg is used, the dist-info directory is packaged as %ghost. When the main package does not have it, the RPM build would succeed. The extras packages would have the python3dist() requires and provides, but the main package would not. By adding %dir after %ghost, we only package the directory (which is enough for python3-rpm-generators to process it), but the files in the directory are not included. When not packaged in the main package, the RPM build fails. This is a safeguard against packaging mistakes. The visible difference is that rpm -ql/repoquery -l would only return the metadata directory. See also https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/195 --- macros.pyproject | 2 +- pyproject-rpm-macros.spec | 6 +++++- tests/python-setuptools_scm.spec | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/macros.pyproject b/macros.pyproject index cf56ef9..6bf5d01 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -103,7 +103,7 @@ fi # Process all *.dist-info dirs in sitelib/sitearch for site_dir in ${site_dirs[@]}; do for distinfo in %{buildroot}$site_dir/*.dist-info; do - echo "%ghost ${distinfo#%{buildroot}}" >> %{_pyproject_ghost_distinfo} + echo "%ghost %dir ${distinfo#%{buildroot}}" >> %{_pyproject_ghost_distinfo} sed -i 's/pip/rpm/' ${distinfo}/INSTALLER PYTHONPATH=%{_rpmconfigdir}/redhat \\ %{__python3} -B %{_rpmconfigdir}/redhat/pyproject_preprocess_record.py \\ diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index f8364b5..877615b 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -14,7 +14,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.18.4 +Version: 1.18.5 Release: 1%{?dist} # Macro files @@ -167,6 +167,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog +* Thu Oct 16 2025 Miro Hrončok - 1.18.5-1 +- %%pyproject_extras_subpkg: Only %%ghost the dist-info directory, not the content +- That way, accidentally unpackaged files within are reported as errors + * Mon Sep 01 2025 Miro Hrončok - 1.18.4-1 - Don't exit from pyproject-srpm-macros implementation of %%pyproject_buildrequires - Fixes: rhbz#2391290 diff --git a/tests/python-setuptools_scm.spec b/tests/python-setuptools_scm.spec index 6d4f1be..f5ad5c9 100644 --- a/tests/python-setuptools_scm.spec +++ b/tests/python-setuptools_scm.spec @@ -67,7 +67,7 @@ grep -E 'flake8: (OK|commands succeeded)' toxlog %{?!with_flake8:&& exit 1 || tr # Internal check for our macros # making sure that %%{_pyproject_ghost_distinfo} has the right content test -f %{_pyproject_ghost_distinfo} -test "$(cat %{_pyproject_ghost_distinfo})" == "%ghost %{python3_sitelib}/setuptools_scm-%{version}.dist-info" +test "$(cat %{_pyproject_ghost_distinfo})" == "%ghost %dir %{python3_sitelib}/setuptools_scm-%{version}.dist-info" %files -n python3-setuptools_scm -f %{pyproject_files} From 10f0ca0ffa77516b31a16f0541b657b1ec83aec2 Mon Sep 17 00:00:00 2001 From: Gordon Messmer Date: Thu, 23 Oct 2025 11:08:54 -0700 Subject: [PATCH 33/34] %pyproject_save_files: Also save top level typing stub files (.pyi) --- pyproject-rpm-macros.spec | 1 + pyproject_save_files.py | 3 +++ pyproject_save_files_test_data.yaml | 6 ++++++ test_RECORD | 1 + test_pyproject_save_files.py | 1 + 5 files changed, 12 insertions(+) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 877615b..880ffa1 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -170,6 +170,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 * Thu Oct 16 2025 Miro Hrončok - 1.18.5-1 - %%pyproject_extras_subpkg: Only %%ghost the dist-info directory, not the content - That way, accidentally unpackaged files within are reported as errors +- %%pyproject_save_files: Also save top level typing stub files (.pyi) * Mon Sep 01 2025 Miro Hrončok - 1.18.4-1 - Don't exit from pyproject-srpm-macros implementation of %%pyproject_buildrequires diff --git a/pyproject_save_files.py b/pyproject_save_files.py index 7ae4193..dcc53e4 100644 --- a/pyproject_save_files.py +++ b/pyproject_save_files.py @@ -395,6 +395,9 @@ def classify_paths( # extension modules can have 2 suffixes name = BuildrootPath(path.stem).stem add_file_to_module(paths, name, "extension", "files", path) + elif path.suffix == ".pyi": + name = path.stem + add_file_to_module(paths, name, "stub", "files", path) elif path.suffix == ".py": name = path.stem # we add the .pyc files, but not top-level __pycache__ diff --git a/pyproject_save_files_test_data.yaml b/pyproject_save_files_test_data.yaml index a3dd24f..82d47ac 100644 --- a/pyproject_save_files_test_data.yaml +++ b/pyproject_save_files_test_data.yaml @@ -213,6 +213,10 @@ classified: - /usr/lib/python3.7/site-packages/__pycache__/tldr.cpython-37{,.opt-?}.pyc dirs: [] type: script + - files: + - /usr/lib/python3.7/site-packages/tldr.pyi + dirs: [] + type: stub other: files: - /usr/bin/tldr @@ -7572,6 +7576,7 @@ dumped: - /usr/lib/python3.7/site-packages/tldr-0.5.dist-info/WHEEL - /usr/lib/python3.7/site-packages/tldr-0.5.dist-info/top_level.txt - /usr/lib/python3.7/site-packages/tldr.py + - /usr/lib/python3.7/site-packages/tldr.pyi - /usr/share/man/man1/tldr* - - tldr - - mistune @@ -15665,6 +15670,7 @@ records: tldr-0.5.dist-info/WHEEL,sha256=S8S5VL-stOTSZDYxHyf0KP7eds0J72qrK0Evu3TfyAY,92 tldr-0.5.dist-info/top_level.txt,sha256=xHSI9WD6Y-_hONbi2b_9RIn9oiO7RBGHU3A8geJq3mI,5 tldr.py,sha256=aJlA3tIz4QYYy8e7DZUhPyLCqTwnfFjA7Nubwm9bPe0,12779 + tldr.pyi,sha256=GxQ4ZGLPQObN92QW_Hb8IJPEuYINNn186FjrRovM09g,13 mistune: path: /usr/lib64/python3.7/site-packages/mistune-0.8.3.dist-info/RECORD diff --git a/test_RECORD b/test_RECORD index e917ce9..cfc31d7 100644 --- a/test_RECORD +++ b/test_RECORD @@ -9,3 +9,4 @@ tldr-0.5.dist-info/RECORD,, tldr-0.5.dist-info/WHEEL,sha256=S8S5VL-stOTSZDYxHyf0KP7eds0J72qrK0Evu3TfyAY,92 tldr-0.5.dist-info/top_level.txt,sha256=xHSI9WD6Y-_hONbi2b_9RIn9oiO7RBGHU3A8geJq3mI,5 tldr.py,sha256=aJlA3tIz4QYYy8e7DZUhPyLCqTwnfFjA7Nubwm9bPe0,12779 +tldr.pyi,sha256=GxQ4ZGLPQObN92QW_Hb8IJPEuYINNn186FjrRovM09g,13 diff --git a/test_pyproject_save_files.py b/test_pyproject_save_files.py index 46aa230..5ee5893 100755 --- a/test_pyproject_save_files.py +++ b/test_pyproject_save_files.py @@ -103,6 +103,7 @@ def test_parse_record_tldr(): str(SITELIB / "tldr-0.5.dist-info/WHEEL"), str(SITELIB / "tldr-0.5.dist-info/top_level.txt"), str(SITELIB / "tldr.py"), + str(SITELIB / "tldr.pyi"), ] assert output == expected From bbcef5f6719e7dfa605478d0638b6b56fab14d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 28 Nov 2025 15:09:26 +0100 Subject: [PATCH 34/34] CI: Make python-ldap build on EPEL 10 Proper fix: https://src.fedoraproject.org/rpms/python-ldap/c/47844650aa --- tests/python-ldap.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index 9e7c593..243888b 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -17,7 +17,6 @@ BuildRequires: cyrus-sasl-devel BuildRequires: gcc BuildRequires: openldap-clients BuildRequires: openldap-devel -BuildRequires: openldap-servers BuildRequires: openssl-devel @@ -40,7 +39,7 @@ Summary: %{summary} %prep %autosetup -# Hack: We remove tests that are broken by OpenLDAP 2.5+ +# Hack: We remove tests that are broken by OpenLDAP 2.5+ and/or require openldap-servers # Don't do this in the regular Fedora package, please rm Tests/t_ldapobject.py Tests/t_cext.py Tests/t_edit.py Tests/t_ldap_sasl.py Tests/t_ldap_syncrepl.py Tests/t_slapdobject.py Tests/t_bind.py Tests/t_ldap_options.py Tests/t_ldap_schema_subentry.py