|
|
cef3bf |
From ff395f4a820497a443baa6cd0198c49b06207c3f Mon Sep 17 00:00:00 2001
|
|
|
cef3bf |
From: Tomas Orsava <torsava@redhat.com>
|
|
|
cef3bf |
Date: Thu, 16 Feb 2017 11:36:29 +0100
|
|
|
cef3bf |
Subject: [PATCH] Fix pythondistdeps.py --provides for Python wheels
|
|
|
cef3bf |
|
|
|
cef3bf |
As Python wheels do not contain targetted Python version in the directory/file
|
|
|
cef3bf |
name of their metadata like Python eggs do, and since the Python version is not
|
|
|
cef3bf |
contained in the metadata either, it is necessary to get it from elsewhere.
|
|
|
cef3bf |
|
|
|
cef3bf |
Here it is parsed from the path the metadata resides at
|
|
|
cef3bf |
(e.g. /usr/lib/pythonX.Y/site-packages/...)
|
|
|
cef3bf |
---
|
|
|
cef3bf |
scripts/pythondistdeps.py | 13 ++++++++++---
|
|
|
cef3bf |
1 file changed, 10 insertions(+), 3 deletions(-)
|
|
|
cef3bf |
|
|
|
cef3bf |
diff --git a/scripts/pythondistdeps.py b/scripts/pythondistdeps.py
|
|
|
cef3bf |
index e4b99e2..d44210c 100644
|
|
|
cef3bf |
--- a/scripts/pythondistdeps.py
|
|
|
cef3bf |
+++ b/scripts/pythondistdeps.py
|
|
|
cef3bf |
@@ -107,10 +107,17 @@ for f in files:
|
|
|
cef3bf |
path_item = f
|
|
|
cef3bf |
metadata = FileMetadata(f)
|
|
|
cef3bf |
dist = Distribution.from_location(path_item, dist_name, metadata)
|
|
|
cef3bf |
- # Check if py_version is defined in the file
|
|
|
cef3bf |
+ # Check if py_version is defined in the metadata file/directory name
|
|
|
cef3bf |
if not dist.py_version:
|
|
|
cef3bf |
- warn("Version for {!r} has not been found".format(dist), RuntimeWarning)
|
|
|
cef3bf |
- continue
|
|
|
cef3bf |
+ # Try to parse the Python version from the path the metadata
|
|
|
cef3bf |
+ # resides at (e.g. /usr/lib/pythonX.Y/site-packages/...)
|
|
|
cef3bf |
+ import re
|
|
|
cef3bf |
+ res = re.search(r"/python(?P<pyver>\d+\.\d)/", path_item)
|
|
|
cef3bf |
+ if res:
|
|
|
cef3bf |
+ dist.py_version = res.group('pyver')
|
|
|
cef3bf |
+ else:
|
|
|
cef3bf |
+ warn("Version for {!r} has not been found".format(dist), RuntimeWarning)
|
|
|
cef3bf |
+ continue
|
|
|
cef3bf |
if (Provides_PyMajorVer_Variant or legacy_Provides or legacy) and Provides:
|
|
|
cef3bf |
# Get the Python major version
|
|
|
cef3bf |
pyver_major = dist.py_version.split('.')[0]
|
|
|
cef3bf |
--
|
|
|
cef3bf |
2.11.0
|
|
|
cef3bf |
|