From 7398b71fbceeabd090c8d768edbf75e9ecaa60af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 21 Jul 2020 22:11:16 +0200 Subject: [PATCH] pythondistdeps.py: When parsing extras name, take the rightmost + --- python-rpm-generators.spec | 5 ++++- pythondistdeps.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/python-rpm-generators.spec b/python-rpm-generators.spec index a4646df..ec09342 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: 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 - 11-10 +- pythondistdeps: Split Python Extras names after the rightmost plus sign + * Fri Jul 10 2020 Tomas Orsava - 11-9 - pythondistdeps: Implement provides/requires for extras packages - Enable --require-extras-subpackages diff --git a/pythondistdeps.py b/pythondistdeps.py index 39e53bc..7b5a0c2 100755 --- a/pythondistdeps.py +++ b/pythondistdeps.py @@ -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()):