pythondistdeps.py: Always output extras names in lowercase

This commit is contained in:
Tomas Orsava 2021-03-11 12:43:37 +01:00
parent b44c808358
commit 3a4efade98
4 changed files with 15 additions and 7 deletions

View File

@ -1,7 +1,7 @@
Name: python-rpm-generators Name: python-rpm-generators
Summary: Dependency generators for Python RPMs Summary: Dependency generators for Python RPMs
Version: 12 Version: 12
Release: 3%{?dist} Release: 4%{?dist}
# Originally all those files were part of RPM, so license is kept here # Originally all those files were part of RPM, so license is kept here
License: GPLv2+ License: GPLv2+
@ -47,6 +47,10 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py
%{_rpmconfigdir}/pythonbundles.py %{_rpmconfigdir}/pythonbundles.py
%changelog %changelog
* Thu Mar 11 2021 Tomas Orsava <torsava@redhat.com> - 12-4
- scripts/pythondistdeps: Treat extras names case-insensitively and always
output them in lower case (#1936875)
* Mon Feb 22 2021 Tomas Orsava <torsava@redhat.com> - 12-3 * Mon Feb 22 2021 Tomas Orsava <torsava@redhat.com> - 12-3
- scripts/pythondistdeps: Fix for Python 3.10 - scripts/pythondistdeps: Fix for Python 3.10

View File

@ -77,7 +77,7 @@ class Distribution(PathDistribution):
self.legacy_normalized_name = legacy_normalize_name(self.name) self.legacy_normalized_name = legacy_normalize_name(self.name)
self.requirements = [Requirement(r) for r in self.requires or []] self.requirements = [Requirement(r) for r in self.requires or []]
self.extras = [ self.extras = [
v for k, v in self.metadata.items() if k == 'Provides-Extra'] v.lower() for k, v in self.metadata.items() if k == 'Provides-Extra']
self.py_version = self._parse_py_version(path) self.py_version = self._parse_py_version(path)
# `name` is defined as a property exactly like this in Python 3.10 in the # `name` is defined as a property exactly like this in Python 3.10 in the
@ -316,7 +316,7 @@ if __name__ == "__main__":
# and pluses in the middle can be easily replaced with dashes. # and pluses in the middle can be easily replaced with dashes.
# Python extras names don't contain pluses according to PEP 508. # Python extras names don't contain pluses according to PEP 508.
package_name_parts = args.package_name.rpartition('+') package_name_parts = args.package_name.rpartition('+')
extras_subpackage = package_name_parts[2] or None extras_subpackage = package_name_parts[2].lower() or None
for f in (args.files or stdin.readlines()): for f in (args.files or stdin.readlines()):
f = f.strip() f = f.strip()
@ -456,7 +456,7 @@ if __name__ == "__main__":
if args.require_extras_subpackages and dep.extras: if args.require_extras_subpackages and dep.extras:
# A dependency can have more than one extras, # A dependency can have more than one extras,
# i.e. foo[bar,baz], so let's go through all of them # i.e. foo[bar,baz], so let's go through all of them
extras_suffixes += [f"[{e}]" for e in dep.extras] extras_suffixes += [f"[{e.lower()}]" for e in dep.extras]
for extras_suffix in extras_suffixes: for extras_suffix in extras_suffixes:
if normalized_names_require_pep503: if normalized_names_require_pep503:

View File

@ -100,3 +100,5 @@ hugo5===11.1.0.post3
test___multiple__underscores==1 test___multiple__underscores==1
test_underscores==1 test_underscores==1
dnspython[DNSSEC]

View File

@ -1193,13 +1193,15 @@
python3.9dist(coverage) python3.9dist(coverage)
python3.9dist(nose) python3.9dist(nose)
python3.9dist(zope-testing) python3.9dist(zope-testing)
--requires: --requires --normalized-names-format pep503 --require-extras-subpackages:
--provides: --provides --normalized-names-format pep503:
pyreq2rpm.tests-2020.04.07.024dab0-py3.9.egg-info: pyreq2rpm.tests-2020.04.07.024dab0-py3.9.egg-info:
provides: python3.9dist(pyreq2rpm.tests) = 2020.04.07.024dab0 provides: python3.9dist(pyreq2rpm-tests) = 2020.04.07.024dab0
requires: |- requires: |-
python(abi) = 3.9 python(abi) = 3.9
((python3.9dist(babel) < 2 or python3.9dist(babel) > 2) with python3.9dist(babel) >= 1.3) ((python3.9dist(babel) < 2 or python3.9dist(babel) > 2) with python3.9dist(babel) >= 1.3)
python3.9dist(dnspython)
python3.9dist(dnspython[dnssec])
python3.9dist(fedora-python-nb2plots) = 0 python3.9dist(fedora-python-nb2plots) = 0
(python3.9dist(foobar0) >= 2.4.8 with python3.9dist(foobar0) < 2.5) (python3.9dist(foobar0) >= 2.4.8 with python3.9dist(foobar0) < 2.5)
(python3.9dist(foobar1) >= 2.4.8 with python3.9dist(foobar1) < 2.4.9) (python3.9dist(foobar1) >= 2.4.8 with python3.9dist(foobar1) < 2.4.9)