pythondistdeps.py: When parsing extras name, take the rightmost +

This commit is contained in:
Miro Hrončok 2020-07-21 22:11:16 +02:00
parent d1a02fdda7
commit 7398b71fbc
2 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,7 @@
Name: python-rpm-generators
Summary: Dependency generators for Python RPMs
Version: 11
Release: 9%{?dist}
Release: 10%{?dist}
# Originally all those files were part of RPM, so license is kept here
License: GPLv2+
@ -47,6 +47,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py
%{_rpmconfigdir}/pythonbundles.py
%changelog
* Tue Jul 21 2020 Miro Hrončok <mhroncok@redhat.com> - 11-10
- pythondistdeps: Split Python Extras names after the rightmost plus sign
* Fri Jul 10 2020 Tomas Orsava <torsava@redhat.com> - 11-9
- pythondistdeps: Implement provides/requires for extras packages
- Enable --require-extras-subpackages

View File

@ -205,8 +205,15 @@ if __name__ == "__main__":
# Is this script being run for an extras subpackage?
extras_subpackage = None
if args.package_name:
package_name_parts = args.package_name.partition('+')
if args.package_name and '+' in args.package_name:
# The extras names are encoded in the package names after the + sign.
# We take the part after the rightmost +, ignoring when empty,
# this allows packages like nicotine+ or c++ to work fine.
# While packages with names like +spam or foo+bar would break,
# names started with the plus sign are not very common
# and pluses in the middle can be easily replaced with dashes.
# Python extras names don't contain pluses according to PEP 508.
package_name_parts = args.package_name.rpartition('+')
extras_subpackage = package_name_parts[2] or None
for f in (args.files or stdin.readlines()):