From ab5e6f86de9e9e4f45ef803fc06378bf60010384 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 3 Mar 2026 12:22:58 +0100 Subject: [PATCH 1/9] Use deprecated LegacyVersion (_version) only if necessary LegacyVersion has been removed from Packaging in 2022. If the call to `parse` function returns LegacyVersion, access to version._version cannot emit DeprecationWarning. Fixes: rhbz#2442867 --- python-rpm-generators.spec | 5 ++++- pythondistdeps.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/python-rpm-generators.spec b/python-rpm-generators.spec index 7e362c8..170f350 100644 --- a/python-rpm-generators.spec +++ b/python-rpm-generators.spec @@ -1,7 +1,7 @@ Name: python-rpm-generators Summary: Dependency generators for Python RPMs Version: 14 -Release: 14%{?dist} +Release: 15%{?dist} Url: https://src.fedoraproject.org/rpms/python-rpm-generators @@ -56,6 +56,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py %{_rpmconfigdir}/pythonbundles.py %changelog +* Wed Mar 04 2026 Lumír Balhar - 14-15 +- pythondistdeps: Use deprecated LegacyVersion (_version) only if necessary + * Sat Jan 17 2026 Fedora Release Engineering - 14-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild diff --git a/pythondistdeps.py b/pythondistdeps.py index b43ed39..d6f5f46 100755 --- a/pythondistdeps.py +++ b/pythondistdeps.py @@ -133,14 +133,14 @@ class Distribution(PathDistribution): class RpmVersion(): def __init__(self, version_id): version = parse(version_id) - if isinstance(version._version, str): + if version.__class__.__name__ == 'LegacyVersion': self.version = version._version else: - self.epoch = version._version.epoch - self.version = list(version._version.release) - self.pre = version._version.pre - self.dev = version._version.dev - self.post = version._version.post + self.epoch = version.epoch + self.version = list(version.release) + self.pre = version.pre + self.dev = version.dev + self.post = version.post # version.local is ignored as it is not expected to appear # in public releases # https://www.python.org/dev/peps/pep-0440/#local-version-identifiers @@ -171,9 +171,9 @@ class RpmVersion(): if self.pre: rpm_suffix = '~{}'.format(''.join(str(x) for x in self.pre)) elif self.dev: - rpm_suffix = '~~{}'.format(''.join(str(x) for x in self.dev)) + rpm_suffix = '~~dev{}'.format(self.dev) elif self.post: - rpm_suffix = '^post{}'.format(self.post[1]) + rpm_suffix = '^post{}'.format(self.post) else: rpm_suffix = '' return '{}{}{}'.format(rpm_epoch, rpm_version, rpm_suffix) From 717202c9e780f9b96ad6662dd70b87b9df10486b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 10 Mar 2026 13:55:10 +0100 Subject: [PATCH 2/9] CI: Adjust a test script to work on Fedora ELN Partial backport of https://gitlab.com/redhat/centos-stream/rpms/python-rpm-generators/-/commit/c2d6a50db3 Fixes: rhbz#2444367 [skip changelog] Co-Authored-By: Karolina Surma --- tests/pythonname.sh | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/tests/pythonname.sh b/tests/pythonname.sh index f737a1f..d5db88a 100755 --- a/tests/pythonname.sh +++ b/tests/pythonname.sh @@ -3,6 +3,7 @@ rpmbuild -ba pythonname.spec X_Y=$(rpm --eval '%python3_version') RPMDIR=$(rpm --eval '%_topdir')/RPMS/noarch +DISTRO=$(rpm --eval '%{?rhel:rhel}%{?fedora:fedora}') echo "Provides for python${X_Y}-foo" rpm -qp --provides ${RPMDIR}/python${X_Y}-foo-0-0.noarch.rpm @@ -43,8 +44,13 @@ test $(rpm -qp --obsoletes ${RPMDIR}/python${X_Y}-foo-0-0.noarch.rpm | wc -l) -e echo "Obsoletes for python3-foo" rpm -qp --obsoletes ${RPMDIR}/python3-foo-0-0.noarch.rpm # In ELN/RHEL the pythonX.Y-* Obsoletes is generated, but not in Fedora, so we check for it explicitly. -rpm -qp --obsoletes ${RPMDIR}/python3-foo-0-0.noarch.rpm | grep -q '^python'${X_Y}'-foo < 0-0$' && exit 1 || true -test $(rpm -qp --obsoletes ${RPMDIR}/python3-foo-0-0.noarch.rpm | wc -l) -eq 0 +if [[ "$DISTRO" = "rhel" ]]; then + rpm -qp --obsoletes ${RPMDIR}/python3-foo-0-0.noarch.rpm | grep -q '^python'${X_Y}'-foo < 0-0$' + test $(rpm -qp --obsoletes ${RPMDIR}/python3-foo-0-0.noarch.rpm | wc -l) -eq 1 +else + rpm -qp --obsoletes ${RPMDIR}/python3-foo-0-0.noarch.rpm | grep -q '^python'${X_Y}'-foo < 0-0$' && exit 1 || true + test $(rpm -qp --obsoletes ${RPMDIR}/python3-foo-0-0.noarch.rpm | wc -l) -eq 0 +fi echo "Obsoletes for python2-foo" rpm -qp --obsoletes ${RPMDIR}/python2-foo-0-0.noarch.rpm @@ -63,14 +69,24 @@ rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm # The deprecated %python_provide macro always obsoletes python-foo rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep -q '^python-python_provide < 0-0$' # In ELN/RHEL the pythonX.Y-* Obsoletes is generated, but not in Fedora, so we check for it explicitly. -rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep -q '^python'${X_Y}'-python_provide < 0-0$' && exit 1 || true -test $(rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep python-python_provide | wc -l) -eq 1 -test $(rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | wc -l) -eq 1 +if [[ "$DISTRO" = "rhel" ]]; then + rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep -q '^python'${X_Y}'-python_provide < 0-0$' + test $(rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep python-python_provide | wc -l) -eq 1 + test $(rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | wc -l) -eq 2 +else + rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep -q '^python'${X_Y}'-python_provide < 0-0$' && exit 1 || true + test $(rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep python-python_provide | wc -l) -eq 1 + test $(rpm -qp --obsoletes ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | wc -l) -eq 1 +fi echo "Obsoletes for python3-py_provides" rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | grep -q '^python-py_provides < 0-0$' && exit 1 || true # In ELN/RHEL the pythonX.Y-* Obsoletes is generated, but not in Fedora, so we check for it explicitly. -rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | grep -q '^python'${X_Y}'-py_provides < 0-0$' && exit 1 || true -test $(rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | wc -l) -eq 0 - +if [[ "$DISTRO" = "rhel" ]]; then + rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | grep -q '^python'${X_Y}'-py_provides < 0-0$' + test $(rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | wc -l) -eq 1 +else + rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | grep -q '^python'${X_Y}'-py_provides < 0-0$' && exit 1 || true + test $(rpm -qp --obsoletes ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | wc -l) -eq 0 +fi From d99d54ea1ae7841713f79541e5507b40ad314fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 11 Mar 2026 20:08:08 +0100 Subject: [PATCH 3/9] CI: Drop outdated requirement of python3-wheel [skip changelog] --- plan.fmf | 1 - tests/test_scripts_pythondistdeps.py | 1 - 2 files changed, 2 deletions(-) diff --git a/plan.fmf b/plan.fmf index d2c549f..0e0ca4d 100644 --- a/plan.fmf +++ b/plan.fmf @@ -34,7 +34,6 @@ prepare: - python3-pytest - python3-pyyaml - python3-setuptools - - python3-wheel - dnf - name: Update packages how: shell diff --git a/tests/test_scripts_pythondistdeps.py b/tests/test_scripts_pythondistdeps.py index 7a7f57a..5fd7fc9 100644 --- a/tests/test_scripts_pythondistdeps.py +++ b/tests/test_scripts_pythondistdeps.py @@ -25,7 +25,6 @@ # - setuptools # - pytest # - pyyaml -# - wheel from pathlib import Path From 0a9a806415d74165c3a8ba374a16cdc8c9e709c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 11 Mar 2026 20:44:38 +0100 Subject: [PATCH 4/9] CI: Replace deprecated pkg_resources with packaging [skip changelog] --- plan.fmf | 1 + tests/test_scripts_pythondistdeps.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plan.fmf b/plan.fmf index 0e0ca4d..7fd67bf 100644 --- a/plan.fmf +++ b/plan.fmf @@ -30,6 +30,7 @@ prepare: - rpmdevtools - fedpkg-minimal - python3-devel + - python3-packaging - python3-pip - python3-pytest - python3-pyyaml diff --git a/tests/test_scripts_pythondistdeps.py b/tests/test_scripts_pythondistdeps.py index 5fd7fc9..e710e6d 100644 --- a/tests/test_scripts_pythondistdeps.py +++ b/tests/test_scripts_pythondistdeps.py @@ -22,7 +22,7 @@ # Requirements for this script: # - Python >= 3.6 # - pip >= 20.0.1 -# - setuptools +# - packaging # - pytest # - pyyaml @@ -136,10 +136,10 @@ def check_and_install_test_data(): backup_argv = sys.argv[:] if type == "wheel": - from pkg_resources import parse_version + from packaging.version import Version abi = f"cp{py_version_nodots}" # The "m" was removed from the abi flag in Python version 3.8 - if parse_version(py_version) < parse_version('3.8'): + if Version(py_version) < Version('3.8'): abi += "m" # Install = download and unpack wheel into our From 0770a2503b950a2bf4d4eb398f87ebc4ef14256a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 14 May 2026 20:26:45 +0200 Subject: [PATCH 5/9] Convert to %autorelease and %autochangelog [skip changelog] --- changelog | 242 ++++++++++++++++++++++++++++++++++++ python-rpm-generators.spec | 245 +------------------------------------ 2 files changed, 244 insertions(+), 243 deletions(-) create mode 100644 changelog diff --git a/changelog b/changelog new file mode 100644 index 0000000..243d571 --- /dev/null +++ b/changelog @@ -0,0 +1,242 @@ +* Wed Mar 04 2026 Lumír Balhar - 14-15 +- pythondistdeps: Use deprecated LegacyVersion (_version) only if necessary + +* Sat Jan 17 2026 Fedora Release Engineering - 14-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild + +* Fri Jul 25 2025 Fedora Release Engineering - 14-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Sat Jan 18 2025 Fedora Release Engineering - 14-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Fri Jul 19 2024 Fedora Release Engineering - 14-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jan 26 2024 Fedora Release Engineering - 14-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 14-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Tue Oct 03 2023 Miro Hrončok - 14-8 +- Avoid DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors + +* Fri Jul 21 2023 Fedora Release Engineering - 14-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed May 24 2023 Todd Zullinger - 14-6 +- Fix URL tag + +* Fri May 05 2023 Miro Hrončok - 14-5 +- Declare the license via a complex SPDX expression rather than "effective license" + +* Mon Apr 17 2023 Kalev Lember - 14-4 +- Generate provides for /app-installed flatpak builds + +* Tue Mar 07 2023 Miro Hrončok - 14-3 +- Avoid needless pkg_resources import in pythonbundles.py +- Ignore environment markers in pythonbundles.py + +* Fri Jan 20 2023 Fedora Release Engineering - 14-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Dec 22 2022 Karolina Surma - 14-1 +- https://fedoraproject.org/wiki/Changes/Prevent-Providing-python3dist(pkg)=0 + +* Fri Jul 22 2022 Fedora Release Engineering - 13-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jun 02 2022 Miro Hrončok - 13-1 +- https://fedoraproject.org/wiki/Changes/PythonDistPEP503ProvidesOnly + +* Fri May 27 2022 Miro Hrončok - 12-15 +- Don't include all requirements with True-evaluating markers in extras subpackages +- Fixes: rhbz#2090186 + +* Thu Feb 10 2022 Sandro Mani - 12-14 +- Add namespace option to pythodistdeps.py to allow mingw-python generatros + +* Wed Jan 26 2022 Tomas Orsava - 12-13 +- From `python3-foo` packages automatically generate `python3.X-foo` Obsoletes + tags on CentOS/RHEL + +* Fri Jan 21 2022 Fedora Release Engineering - 12-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Sun Dec 19 2021 Gordon Messmer - 12-11 +- Handle legacy version specifiers that would previously raise exceptions. + +* Fri Oct 29 2021 Gordon Messmer - 12-10 +- Additional fix for dev releases. + +* Thu Oct 28 2021 Gordon Messmer - 12-9 +- Sync dependency conversion with upstream pyreq2rpm. +- Improve handling of > and < operators, and != operator with prefix matching + +* Fri Jul 23 2021 Fedora Release Engineering - 12-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue May 25 2021 Tomas Orsava - 12-7 +- pythondistdeps.py: Detect missing or corrupted metadata +- pythondistdeps.py: Catch all exceptions and terminate the build if one is raised + +* Mon Apr 19 2021 Miro Hrončok - 12-6 +- Get rid of distutils deprecation warning (by not using it) +- The distutils module is deprecated in Python 3.10+ +- https://www.python.org/dev/peps/pep-0632/ + +* Wed Mar 31 2021 Miro Hrončok - 12-5 +- Do not generate setuptools requirement for console_scripts on Python 3.10+ +- See https://fedoraproject.org/wiki/Changes/Reduce_dependencies_on_python3-setuptools + +* Thu Mar 11 2021 Tomas Orsava - 12-4 +- scripts/pythondistdeps: Treat extras names case-insensitively and always + output them in lower case (#1936875) + +* Mon Feb 22 2021 Tomas Orsava - 12-3 +- scripts/pythondistdeps: Fix for Python 3.10 + +* Wed Feb 17 2021 Tomas Orsava - 12-2 +- scripts/pythondistdeps: Switch from using pkg_resources to importlib.metadata + for reading the egg/dist-info metadata +- The script no longer requires setuptools but instead requires packaging + +* Wed Feb 03 2021 Miro Hrončok - 12-1 +- Disable the dist generators for Python 2 +- https://fedoraproject.org/wiki/Changes/Disable_Python_2_Dist_RPM_Generators_and_Freeze_Python_2_Macros + +* Wed Jan 27 2021 Fedora Release Engineering - 11-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Oct 19 2020 Tomas Orsava - 11-12 +- Run scripts in an isolated Python environment (#1889080) + +* Wed Jul 29 2020 Fedora Release Engineering - 11-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jul 21 2020 Miro Hrončok - 11-10 +- pythondistdeps: Split Python Extras names after the rightmost plus sign +- pythondistdeps: Handle edge cases of version comparisons more closely to + upstream, despite irrationality + See: https://github.com/pypa/packaging/issues/320 + +* Fri Jul 10 2020 Tomas Orsava - 11-9 +- pythondistdeps: Implement provides/requires for extras packages +- Enable --require-extras-subpackages +- Adapt Python version marker workaround for setuptools 42+ + +* Fri Jun 26 2020 Miro Hrončok - 11-8 +- Fix python(abi) requires generator, it picked files from almost good directories +- Add a script to generate Python bundled provides + +* Thu May 21 2020 Miro Hrončok - 11-7 +- Use PEP 503 names for requires + +* Tue May 05 2020 Miro Hrončok - 11-6 +- Deduplicate automatically provided names trough Python RPM Lua macros + +* Wed Apr 29 2020 Tomas Orsava - 11-5 +- Backporting proposed upstream changes + https://github.com/rpm-software-management/rpm/pull/1195 + - Only provide python3dist(..) for the main Python versions (BZ#1812083) + - Preparation for the proper handling of normalized names (BZ#1791530) + - Add a test suite (and enable it in Fedora CI) + - Better error messages for unsupported package versions + - Fix sorting of dev versions + +* Tue Apr 28 2020 Miro Hrončok - 11-4 +- Don't define global Lua variables from Python generator + +* Mon Apr 20 2020 Gordon Messmer - 11-3 +- Handle all-zero versions without crashing + +* Tue Apr 07 2020 Miro Hrončok - 11-2 +- Use dynamic %%_prefix value when matching files for python(abi) provides +- Sync with upstream RPM dist generator + +* Wed Apr 01 2020 Miro Hrončok - 11-1 +- Rewrite python(abi) generators to Lua to make them faster +- RPM 4.16+ is needed +- Automatically call %%python_provide + +* Thu Jan 30 2020 Fedora Release Engineering - 10-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Jan 17 2020 Miro Hrončok - 10-3 +- Also provide pythonXdist() with PEP 503 normalized names (#1791530) + +* Fri Jan 03 2020 Miro Hrončok - 10-2 +- Fix more complicated requirement expressions by adding parenthesis + +* Wed Jan 01 2020 Miro Hrončok - 10-1 +- Handle version ending with ".*" (#1758141) +- Handle compatible-release operator "~=" (#1758141) +- Use rich deps for semantically versioned dependencies +- Match Python version if minor has multiple digits (e.g. 3.10, #1777382) +- Only add setuptools requirement for egg-info packages + +* Fri Jul 26 2019 Fedora Release Engineering - 9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Jun 24 2019 Tomas Orsava - 9-1 +- Canonicalize Python versions and properly handle != spec + +* Wed Apr 17 2019 Miro Hrončok - 8-1 +- console_scripts entry points to require setuptools + https://github.com/rpm-software-management/rpm/pull/666 + +* Sat Feb 02 2019 Fedora Release Engineering - 7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Dec 20 2018 Igor Gnatenko - 7-1 +- Enable requires generator + +* Wed Oct 03 2018 Igor Gnatenko - 6-1 +- Tighten regex for depgen + +* Sat Jul 28 2018 Miro Hrončok - 5-4 +- Use nonstandardlib for purelib definition (#1609492) + +* Sat Jul 28 2018 Igor Gnatenko - 5-3 +- Add pythondist generator + +* Sat Jul 14 2018 Fedora Release Engineering - 5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Sun Feb 11 2018 Igor Gnatenko - 5-1 +- Fork upstream generators +- "Fix" support of environment markers + +* Fri Feb 09 2018 Fedora Release Engineering - 4.14.0-2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Nov 28 2017 Tomas Orsava - 4.14.0-2 +- Switch bootsrapping macro to a bcond for modularity + +* Fri Oct 20 2017 Tomas Orsava - 4.14.0-1 +- Rebase to rpm 4.14.0 final (http://rpm.org/wiki/Releases/4.14.0) +- Re-synchronize version/release macros with the rpm Fedora package + +* Mon Sep 18 2017 Tomas Orsava - 4.14.0-0.rc1.1 +- Update to a new upstream version of RPM +- Drop upstreamed patches +- Renumber remaining patches + +* Thu Aug 24 2017 Miro Hrončok - 4.13.0.1-4 +- Add patch 10: Do not provide pythonXdist for platform-python packages (rhbz#1484607) + +* Tue Aug 08 2017 Tomas Orsava - 4.13.0.1-3 +- Add patch 9: Generate requires and provides for platform-python(abi) + (https://fedoraproject.org/wiki/Changes/Platform_Python_Stack) + +* Thu Jul 27 2017 Fedora Release Engineering - 4.13.0.1-2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu May 18 2017 Tomas Orsava - 4.13.0.1-2 +- Added a license file +- Added a dependency on rpm for the proper directory structure +- Properly owning the __pycache__ directory + +* Tue May 02 2017 Tomas Orsava - 4.13.0.1-1 +- Splitting Python RPM generators from the `rpm` package to standalone one diff --git a/python-rpm-generators.spec b/python-rpm-generators.spec index 170f350..0e080a7 100644 --- a/python-rpm-generators.spec +++ b/python-rpm-generators.spec @@ -1,7 +1,7 @@ Name: python-rpm-generators Summary: Dependency generators for Python RPMs Version: 14 -Release: 15%{?dist} +Release: %autorelease Url: https://src.fedoraproject.org/rpms/python-rpm-generators @@ -56,245 +56,4 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py %{_rpmconfigdir}/pythonbundles.py %changelog -* Wed Mar 04 2026 Lumír Balhar - 14-15 -- pythondistdeps: Use deprecated LegacyVersion (_version) only if necessary - -* Sat Jan 17 2026 Fedora Release Engineering - 14-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild - -* Fri Jul 25 2025 Fedora Release Engineering - 14-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Sat Jan 18 2025 Fedora Release Engineering - 14-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Fri Jul 19 2024 Fedora Release Engineering - 14-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Fri Jan 26 2024 Fedora Release Engineering - 14-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Mon Jan 22 2024 Fedora Release Engineering - 14-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Tue Oct 03 2023 Miro Hrončok - 14-8 -- Avoid DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors - -* Fri Jul 21 2023 Fedora Release Engineering - 14-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Wed May 24 2023 Todd Zullinger - 14-6 -- Fix URL tag - -* Fri May 05 2023 Miro Hrončok - 14-5 -- Declare the license via a complex SPDX expression rather than "effective license" - -* Mon Apr 17 2023 Kalev Lember - 14-4 -- Generate provides for /app-installed flatpak builds - -* Tue Mar 07 2023 Miro Hrončok - 14-3 -- Avoid needless pkg_resources import in pythonbundles.py -- Ignore environment markers in pythonbundles.py - -* Fri Jan 20 2023 Fedora Release Engineering - 14-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Thu Dec 22 2022 Karolina Surma - 14-1 -- https://fedoraproject.org/wiki/Changes/Prevent-Providing-python3dist(pkg)=0 - -* Fri Jul 22 2022 Fedora Release Engineering - 13-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Thu Jun 02 2022 Miro Hrončok - 13-1 -- https://fedoraproject.org/wiki/Changes/PythonDistPEP503ProvidesOnly - -* Fri May 27 2022 Miro Hrončok - 12-15 -- Don't include all requirements with True-evaluating markers in extras subpackages -- Fixes: rhbz#2090186 - -* Thu Feb 10 2022 Sandro Mani - 12-14 -- Add namespace option to pythodistdeps.py to allow mingw-python generatros - -* Wed Jan 26 2022 Tomas Orsava - 12-13 -- From `python3-foo` packages automatically generate `python3.X-foo` Obsoletes - tags on CentOS/RHEL - -* Fri Jan 21 2022 Fedora Release Engineering - 12-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Sun Dec 19 2021 Gordon Messmer - 12-11 -- Handle legacy version specifiers that would previously raise exceptions. - -* Fri Oct 29 2021 Gordon Messmer - 12-10 -- Additional fix for dev releases. - -* Thu Oct 28 2021 Gordon Messmer - 12-9 -- Sync dependency conversion with upstream pyreq2rpm. -- Improve handling of > and < operators, and != operator with prefix matching - -* Fri Jul 23 2021 Fedora Release Engineering - 12-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Tue May 25 2021 Tomas Orsava - 12-7 -- pythondistdeps.py: Detect missing or corrupted metadata -- pythondistdeps.py: Catch all exceptions and terminate the build if one is raised - -* Mon Apr 19 2021 Miro Hrončok - 12-6 -- Get rid of distutils deprecation warning (by not using it) -- The distutils module is deprecated in Python 3.10+ -- https://www.python.org/dev/peps/pep-0632/ - -* Wed Mar 31 2021 Miro Hrončok - 12-5 -- Do not generate setuptools requirement for console_scripts on Python 3.10+ -- See https://fedoraproject.org/wiki/Changes/Reduce_dependencies_on_python3-setuptools - -* Thu Mar 11 2021 Tomas Orsava - 12-4 -- scripts/pythondistdeps: Treat extras names case-insensitively and always - output them in lower case (#1936875) - -* Mon Feb 22 2021 Tomas Orsava - 12-3 -- scripts/pythondistdeps: Fix for Python 3.10 - -* Wed Feb 17 2021 Tomas Orsava - 12-2 -- scripts/pythondistdeps: Switch from using pkg_resources to importlib.metadata - for reading the egg/dist-info metadata -- The script no longer requires setuptools but instead requires packaging - -* Wed Feb 03 2021 Miro Hrončok - 12-1 -- Disable the dist generators for Python 2 -- https://fedoraproject.org/wiki/Changes/Disable_Python_2_Dist_RPM_Generators_and_Freeze_Python_2_Macros - -* Wed Jan 27 2021 Fedora Release Engineering - 11-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Oct 19 2020 Tomas Orsava - 11-12 -- Run scripts in an isolated Python environment (#1889080) - -* Wed Jul 29 2020 Fedora Release Engineering - 11-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Tue Jul 21 2020 Miro Hrončok - 11-10 -- pythondistdeps: Split Python Extras names after the rightmost plus sign -- pythondistdeps: Handle edge cases of version comparisons more closely to - upstream, despite irrationality - See: https://github.com/pypa/packaging/issues/320 - -* Fri Jul 10 2020 Tomas Orsava - 11-9 -- pythondistdeps: Implement provides/requires for extras packages -- Enable --require-extras-subpackages -- Adapt Python version marker workaround for setuptools 42+ - -* Fri Jun 26 2020 Miro Hrončok - 11-8 -- Fix python(abi) requires generator, it picked files from almost good directories -- Add a script to generate Python bundled provides - -* Thu May 21 2020 Miro Hrončok - 11-7 -- Use PEP 503 names for requires - -* Tue May 05 2020 Miro Hrončok - 11-6 -- Deduplicate automatically provided names trough Python RPM Lua macros - -* Wed Apr 29 2020 Tomas Orsava - 11-5 -- Backporting proposed upstream changes - https://github.com/rpm-software-management/rpm/pull/1195 - - Only provide python3dist(..) for the main Python versions (BZ#1812083) - - Preparation for the proper handling of normalized names (BZ#1791530) - - Add a test suite (and enable it in Fedora CI) - - Better error messages for unsupported package versions - - Fix sorting of dev versions - -* Tue Apr 28 2020 Miro Hrončok - 11-4 -- Don't define global Lua variables from Python generator - -* Mon Apr 20 2020 Gordon Messmer - 11-3 -- Handle all-zero versions without crashing - -* Tue Apr 07 2020 Miro Hrončok - 11-2 -- Use dynamic %%_prefix value when matching files for python(abi) provides -- Sync with upstream RPM dist generator - -* Wed Apr 01 2020 Miro Hrončok - 11-1 -- Rewrite python(abi) generators to Lua to make them faster -- RPM 4.16+ is needed -- Automatically call %%python_provide - -* Thu Jan 30 2020 Fedora Release Engineering - 10-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Fri Jan 17 2020 Miro Hrončok - 10-3 -- Also provide pythonXdist() with PEP 503 normalized names (#1791530) - -* Fri Jan 03 2020 Miro Hrončok - 10-2 -- Fix more complicated requirement expressions by adding parenthesis - -* Wed Jan 01 2020 Miro Hrončok - 10-1 -- Handle version ending with ".*" (#1758141) -- Handle compatible-release operator "~=" (#1758141) -- Use rich deps for semantically versioned dependencies -- Match Python version if minor has multiple digits (e.g. 3.10, #1777382) -- Only add setuptools requirement for egg-info packages - -* Fri Jul 26 2019 Fedora Release Engineering - 9-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Mon Jun 24 2019 Tomas Orsava - 9-1 -- Canonicalize Python versions and properly handle != spec - -* Wed Apr 17 2019 Miro Hrončok - 8-1 -- console_scripts entry points to require setuptools - https://github.com/rpm-software-management/rpm/pull/666 - -* Sat Feb 02 2019 Fedora Release Engineering - 7-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Thu Dec 20 2018 Igor Gnatenko - 7-1 -- Enable requires generator - -* Wed Oct 03 2018 Igor Gnatenko - 6-1 -- Tighten regex for depgen - -* Sat Jul 28 2018 Miro Hrončok - 5-4 -- Use nonstandardlib for purelib definition (#1609492) - -* Sat Jul 28 2018 Igor Gnatenko - 5-3 -- Add pythondist generator - -* Sat Jul 14 2018 Fedora Release Engineering - 5-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Sun Feb 11 2018 Igor Gnatenko - 5-1 -- Fork upstream generators -- "Fix" support of environment markers - -* Fri Feb 09 2018 Fedora Release Engineering - 4.14.0-2.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Tue Nov 28 2017 Tomas Orsava - 4.14.0-2 -- Switch bootsrapping macro to a bcond for modularity - -* Fri Oct 20 2017 Tomas Orsava - 4.14.0-1 -- Rebase to rpm 4.14.0 final (http://rpm.org/wiki/Releases/4.14.0) -- Re-synchronize version/release macros with the rpm Fedora package - -* Mon Sep 18 2017 Tomas Orsava - 4.14.0-0.rc1.1 -- Update to a new upstream version of RPM -- Drop upstreamed patches -- Renumber remaining patches - -* Thu Aug 24 2017 Miro Hrončok - 4.13.0.1-4 -- Add patch 10: Do not provide pythonXdist for platform-python packages (rhbz#1484607) - -* Tue Aug 08 2017 Tomas Orsava - 4.13.0.1-3 -- Add patch 9: Generate requires and provides for platform-python(abi) - (https://fedoraproject.org/wiki/Changes/Platform_Python_Stack) - -* Thu Jul 27 2017 Fedora Release Engineering - 4.13.0.1-2.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Thu May 18 2017 Tomas Orsava - 4.13.0.1-2 -- Added a license file -- Added a dependency on rpm for the proper directory structure -- Properly owning the __pycache__ directory - -* Tue May 02 2017 Tomas Orsava - 4.13.0.1-1 -- Splitting Python RPM generators from the `rpm` package to standalone one +%autochangelog From eb1bf7bea6f312b3a81fefb4cd100fd3a9448325 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jul 2026 21:39:29 +0000 Subject: [PATCH 6/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild From 9d214678c4b3c976af53671446dc6d19ccac559f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 12 Aug 2026 21:17:14 +0200 Subject: [PATCH 7/9] Properly handle missing METADATA on Python 3.15+ See https://github.com/python/cpython/issues/143387 Used LLM to analyze a CI test failure. Assisted-By: Claude Opus 4.6 --- pythondistdeps.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pythondistdeps.py b/pythondistdeps.py index d6f5f46..8404292 100755 --- a/pythondistdeps.py +++ b/pythondistdeps.py @@ -76,7 +76,12 @@ class Distribution(PathDistribution): # Check that the initialization went well and metadata are not missing or corrupted # name is the most important attribute, if it doesn't exist, import failed - if not self.name or not isinstance(self.name, str): + # Python 3.15+ raises MetadataNotFound (FileNotFoundError) instead of returning None + try: + name = self.name + except FileNotFoundError: + name = None + if not name or not isinstance(name, str): print("*** PYTHON_METADATA_FAILED_TO_PARSE_ERROR___SEE_STDERR ***") print('Error: Python metadata at `{}` are missing or corrupted.'.format(path), file=stderr) exit(65) # os.EX_DATAERR From c88849770b0a8beea977821ca2a87c56124b21c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 14 May 2026 19:27:24 +0200 Subject: [PATCH 8/9] Generate python(abi) Requires for any files in pythonX.Y directory It does not matter if the package installs .py, .so or different files. Packages that simply drop a .pth file to site-packages or even only carry dist-info folder still need to Require the package that owns /usr/lib(64)/pythonX.Y. --- python.attr | 2 +- tests/pythonabi.sh | 3 +++ tests/pythonabi.spec | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/python.attr b/python.attr index cf5ae39..afcb18a 100644 --- a/python.attr +++ b/python.attr @@ -28,4 +28,4 @@ end } -%__python_path ^((%{?!flatpak:/usr}%{?flatpak:/app}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.*\\.(py[oc]?|so))|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$ +%__python_path ^((%{?!flatpak:/usr}%{?flatpak:/app}/lib(64)?/python[[:digit:]]+\\.[[:digit:]]+/.+)|(%{_bindir}/python[[:digit:]]+\\.[[:digit:]]+))$ diff --git a/tests/pythonabi.sh b/tests/pythonabi.sh index 36b6060..03d3723 100755 --- a/tests/pythonabi.sh +++ b/tests/pythonabi.sh @@ -15,5 +15,8 @@ rpm -qp --provides ${RPMDIR}/${ARCH}/python-arched-0-0.${ARCH}.rpm | grep "${ABI rpm -qp --requires ${RPMDIR}/noarch/python-noarch-0-0.noarch.rpm | grep "${ABI}" rpm -qp --provides ${RPMDIR}/noarch/python-noarch-0-0.noarch.rpm | grep "${ABI}" && exit 1 || true +rpm -qp --requires ${RPMDIR}/noarch/python-data-0-0.noarch.rpm | grep "${ABI}" +rpm -qp --provides ${RPMDIR}/noarch/python-data-0-0.noarch.rpm | grep "${ABI}" && exit 1 || true + rpm -qp --provides ${RPMDIR}/${ARCH}/python-misplaced-interpreter-0-0.${ARCH}.rpm | grep "${ABI}" && exit 1 || true rpm -qp --requires ${RPMDIR}/noarch/python-misplaced-library-0-0.noarch.rpm | grep "${ABI}" && exit 1 || true diff --git a/tests/pythonabi.spec b/tests/pythonabi.spec index 4f5e477..c36f81c 100644 --- a/tests/pythonabi.spec +++ b/tests/pythonabi.spec @@ -17,6 +17,7 @@ mkdir -p %{buildroot}/opt%{_bindir} echo "print()" > %{buildroot}%{python3_sitelib}/file.py echo "print()" > %{buildroot}/opt%{python3_sitelib}/file.py +echo "data" > %{buildroot}%{python3_sitelib}/file.txt cp %{python3_sitearch}/../lib-dynload/cmath.*.so %{buildroot}%{python3_sitearch}/file.so @@ -49,6 +50,15 @@ Summary: ... %{_bindir}/python%{python3_version} +%package -n python-data +Summary: ... +BuildArch: noarch +%description -n python-data +... +%files -n python-data +%{python3_sitelib}/file.txt + + %package -n python-misplaced-library Summary: ... BuildArch: noarch From 6afe8d52718a25063b5ca5c3dbc887b20f7f651c Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Tue, 21 Apr 2026 10:35:25 +0200 Subject: [PATCH 9/9] Correctly handle literal '0' values in RpmVersion parts A version string like '0.5.40-0' produces a post suffix 0, which stopped being included in the converted version string because of a too broad of a condition. The converted string before (incomplete): '0.5.40' The converted string now (correct): '0.5.40^post0' This reflects the state of the upstream repository as of https://github.com/gordonmessmer/pyreq2rpm/commit/64474dd1e --- pythondistdeps.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pythondistdeps.py b/pythondistdeps.py index 8404292..a982d9f 100755 --- a/pythondistdeps.py +++ b/pythondistdeps.py @@ -173,11 +173,11 @@ class RpmVersion(): while len(self.version) > 1 and self.version[-1] == 0: self.version.pop() rpm_version = '.'.join(str(x) for x in self.version) - if self.pre: + if self.pre is not None: rpm_suffix = '~{}'.format(''.join(str(x) for x in self.pre)) - elif self.dev: + elif self.dev is not None: rpm_suffix = '~~dev{}'.format(self.dev) - elif self.post: + elif self.post is not None: rpm_suffix = '^post{}'.format(self.post) else: rpm_suffix = '' @@ -266,10 +266,10 @@ def convert_ordered(name, operator, version_id): # For backwards compatibility, fallback to previous behavior with LegacyVersions if not version.is_legacy(): # Prevent dev and pre-releases from satisfying a < requirement - if operator == '<' and not version.pre and not version.dev and not version.post: + if operator == '<' and version.pre is None and version.dev is None and version.post is None: version = '{}~~'.format(version) # Prevent post-releases from satisfying a > requirement - if operator == '>' and not version.pre and not version.dev and not version.post: + if operator == '>' and version.pre is None and version.dev is None and version.post is None: version = '{}.0'.format(version) return '{} {} {}'.format(name, operator, version)