From dd76fcddd8265895b80fde00e51c4b36bb886814 Mon Sep 17 00:00:00 2001 From: shixuantong Date: Tue, 19 Dec 2023 10:20:49 +0800 Subject: [PATCH] Fixed parsing of wheel file names with multiple platform tags (cherry picked from commit 8902f390e7fa2f3bc7e31fc772fd8298ba806570) --- ...le-names-with-multiple-platform-tags.patch | 66 +++++++++++++++++++ python-wheel.spec | 6 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 backport-Fixed-parsing-of-wheel-file-names-with-multiple-platform-tags.patch diff --git a/backport-Fixed-parsing-of-wheel-file-names-with-multiple-platform-tags.patch b/backport-Fixed-parsing-of-wheel-file-names-with-multiple-platform-tags.patch new file mode 100644 index 0000000..bdfe184 --- /dev/null +++ b/backport-Fixed-parsing-of-wheel-file-names-with-multiple-platform-tags.patch @@ -0,0 +1,66 @@ +From 44193907eb308930de05deed863fb4d157c5c866 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= +Date: Sat, 5 Nov 2022 01:17:22 +0200 +Subject: [PATCH] Fixed parsing of wheel file names with multiple platform tags + +Reference:https://github.com/pypa/wheel/commit/44193907eb308930de05deed863fb4d157c5c866 +Conflict:src/wheel/install.py src/tests/test_install.py + +--- + tests/test_install.py | 16 ++++++++++++++-- + wheel/install.py | 4 ++-- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/tests/test_install.py b/tests/test_install.py +index 42db4f0..847bb31 100644 +--- a/tests/test_install.py ++++ b/tests/test_install.py +@@ -20,6 +20,8 @@ import wheel.pep425tags + import wheel.tool + from wheel.install import WheelFile + ++import pytest ++ + THISDIR = os.path.dirname(__file__) + TESTWHEEL = os.path.join(THISDIR, 'test-1.0-py2.py3-none-win32.whl') + +@@ -101,8 +103,18 @@ def test_install_tool(): + """Slightly improve coverage of wheel.install""" + wheel.tool.install([TESTWHEEL], force=True, dry_run=True) + +- +-def test_wheelfile_re(): ++@pytest.mark.parametrize( ++ "filename", ++ [ ++ "foo-2-py3-none-any.whl", ++ "foo-2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", ++ ], ++) ++def test_wheelfile_re(filename, tmpdir): + # Regression test for #208 + wf = WheelFile('foo-2-py3-none-any.whl') + assert wf.distinfo_name == 'foo-2.dist-info' ++ ++ path = tmpdir.join(filename) ++ wf = WheelFile(str(path), "w") ++ assert wf.parsed_filename.group("namever") == "foo-2" +diff --git a/wheel/install.py b/wheel/install.py +index 792b707..26359da 100644 +--- a/wheel/install.py ++++ b/wheel/install.py +@@ -32,8 +32,8 @@ VERSION_TOO_HIGH = (1, 0) + # Non-greedy matching of an optional build number may be too clever (more + # invalid wheel filenames will match). Separate regex for .dist-info? + WHEEL_INFO_RE = re.compile( +- r"""^(?P(?P[^-]+?)-(?P\d[^-]*?))(-(?P\d[^-]*?))? +- -(?P[a-z][^-]+?)-(?P[^-]+?)-(?P[^.]+?)(\.whl|\.dist-info)$""", ++ r"""^(?P(?P[^\s-]+?)-(?P[^\s-]*?))(-(?P\d[^\s-]*?))? ++ -(?P[^\s-]+?)-(?P[^\s-]+?)-(?P\S+?)(\.whl|\.dist-info)$""", + re.VERBOSE).match + + +-- +2.27.0 + + diff --git a/python-wheel.spec b/python-wheel.spec index ed836f4..17970de 100644 --- a/python-wheel.spec +++ b/python-wheel.spec @@ -1,7 +1,7 @@ %bcond_with bootstrap Name: python-wheel Version: 0.31.1 -Release: 6 +Release: 7 Epoch: 1 Summary: Built-package format for Python License: MIT @@ -12,6 +12,7 @@ BuildArch: noarch Patch0000: remove-keyrings.alt-dependency.patch Patch0001: 0001-Enabled-Intersphinx-linking-to-Python-documentation.patch Patch0002: CVE-2022-40898.patch +Patch0003: backport-Fixed-parsing-of-wheel-file-names-with-multiple-platform-tags.patch %description A built-package format for Python. @@ -118,6 +119,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3 -v --ignore build %endif %changelog +* Tue Dec 19 2023 shixuantong - 1:0.31.1-7 +- Fixed parsing of wheel file names with multiple platform tags + * Fri Dec 08 2023 wangkai <13474090681@163.com> - 1:0.31.1-6 - Fix CVE-2022-40898 -- Gitee