From cef3bf822054a87f8f8ae53a31f4af9b3d88359b Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Feb 16 2017 12:54:19 +0000 Subject: Fix handling of Python wheels by pythondistdeps.py --provides (#1421776) --- diff --git a/rpm-4.13.x-pythondistdeps.py-fix-processing-wheels.patch b/rpm-4.13.x-pythondistdeps.py-fix-processing-wheels.patch new file mode 100644 index 0000000..7aa5eb3 --- /dev/null +++ b/rpm-4.13.x-pythondistdeps.py-fix-processing-wheels.patch @@ -0,0 +1,43 @@ +From ff395f4a820497a443baa6cd0198c49b06207c3f Mon Sep 17 00:00:00 2001 +From: Tomas Orsava +Date: Thu, 16 Feb 2017 11:36:29 +0100 +Subject: [PATCH] Fix pythondistdeps.py --provides for Python wheels + +As Python wheels do not contain targetted Python version in the directory/file +name of their metadata like Python eggs do, and since the Python version is not +contained in the metadata either, it is necessary to get it from elsewhere. + +Here it is parsed from the path the metadata resides at +(e.g. /usr/lib/pythonX.Y/site-packages/...) +--- + scripts/pythondistdeps.py | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/scripts/pythondistdeps.py b/scripts/pythondistdeps.py +index e4b99e2..d44210c 100644 +--- a/scripts/pythondistdeps.py ++++ b/scripts/pythondistdeps.py +@@ -107,10 +107,17 @@ for f in files: + path_item = f + metadata = FileMetadata(f) + dist = Distribution.from_location(path_item, dist_name, metadata) +- # Check if py_version is defined in the file ++ # Check if py_version is defined in the metadata file/directory name + if not dist.py_version: +- warn("Version for {!r} has not been found".format(dist), RuntimeWarning) +- continue ++ # Try to parse the Python version from the path the metadata ++ # resides at (e.g. /usr/lib/pythonX.Y/site-packages/...) ++ import re ++ res = re.search(r"/python(?P\d+\.\d)/", path_item) ++ if res: ++ dist.py_version = res.group('pyver') ++ else: ++ warn("Version for {!r} has not been found".format(dist), RuntimeWarning) ++ continue + if (Provides_PyMajorVer_Variant or legacy_Provides or legacy) and Provides: + # Get the Python major version + pyver_major = dist.py_version.split('.')[0] +-- +2.11.0 + diff --git a/rpm.spec b/rpm.spec index 6067093..a5a530b 100644 --- a/rpm.spec +++ b/rpm.spec @@ -29,7 +29,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}1%{?dist} +Release: %{?snapver:0.%{snapver}.}2%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2 @@ -61,6 +61,9 @@ Patch137: rpm-4.13.x-pythondistdeps.py-show-warning-if-version-is-not-fou.patch Patch138: rpm-4.13.x-pythondistdeps.py-skip-.egg-link-files.patch Patch139: rpm-4.13.x-pythondistdeps.py-add-forgotten-import.patch Patch140: rpm-4.13.x-brp-python-bytecompile-Python3-only.patch +# Upstream PR: https://github.com/rpm-software-management/rpm/pull/154 +# rhbz#1421776 +Patch141: rpm-4.13.x-pythondistdeps.py-fix-processing-wheels.patch # Fedora-specific (python3) patch (RHBZ #1405483) Patch200: rpm-4.13.x-pythondistdeps-python3.patch @@ -566,6 +569,9 @@ exit 0 %doc doc/librpm/html/* %changelog +* Thu Feb 16 2017 Tomas Orsava - 4.13.0.1-2 +- Fix handling of Python wheels by pythondistdeps.py --provides (#1421776) + * Thu Feb 16 2017 Panu Matilainen - 4.13.0.1-1 - Update to 4.13.0.1 ((http://rpm.org/wiki/Releases/4.13.0)