From 225823f2f2f3410115beac7806558adde4029bda Mon Sep 17 00:00:00 2001 From: zhangruifang2020 Date: Mon, 12 Aug 2024 11:00:44 +0800 Subject: [PATCH] backport patch from upstream --- ...ng-failure-to-traverse-parent-of-a-d.patch | 25 +++++++++++++++++++ ...ng-slash-from-directory-entries.-Fix.patch | 25 +++++++++++++++++++ python-zipp.spec | 9 ++++++- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 backport-Add-test-capturing-failure-to-traverse-parent-of-a-d.patch create mode 100644 backport-Strip-the-trailing-slash-from-directory-entries.-Fix.patch diff --git a/backport-Add-test-capturing-failure-to-traverse-parent-of-a-d.patch b/backport-Add-test-capturing-failure-to-traverse-parent-of-a-d.patch new file mode 100644 index 0000000..5e8da26 --- /dev/null +++ b/backport-Add-test-capturing-failure-to-traverse-parent-of-a-d.patch @@ -0,0 +1,25 @@ +From ae4be5a235e8952c0d9ee4900f801ff78bce357a Mon Sep 17 00:00:00 2001 +From: "Jason R. Coombs" +Date: Sun, 7 Jul 2019 13:41:33 -0400 +Subject: [PATCH] Add test capturing failure to traverse parent of a directory. + +--- + test_zipp.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/test_zipp.py b/test_zipp.py +index da68fea..3087cbc 100644 +--- a/test_zipp.py ++++ b/test_zipp.py +@@ -170,3 +170,8 @@ class TestEverything(unittest.TestCase): + root = zipp.Path(zipfile_abcde) + assert (root / 'a').parent.at == '' + assert (root / 'a' / 'b').parent.at == 'a/' ++ ++ def test_dir_parent(self): ++ for zipfile_abcde in self.zipfile_abcde(): ++ root = zipp.Path(zipfile_abcde) ++ assert (root / 'b').parent.at == '' +-- +2.33.0 + diff --git a/backport-Strip-the-trailing-slash-from-directory-entries.-Fix.patch b/backport-Strip-the-trailing-slash-from-directory-entries.-Fix.patch new file mode 100644 index 0000000..bb55a31 --- /dev/null +++ b/backport-Strip-the-trailing-slash-from-directory-entries.-Fix.patch @@ -0,0 +1,25 @@ +From 3378887bce94da5372e89c93f101ef9c3f8edff4 Mon Sep 17 00:00:00 2001 +From: "Jason R. Coombs" +Date: Sun, 7 Jul 2019 16:41:45 -0400 +Subject: [PATCH] Strip the trailing slash from directory entries. Fixes #7. + +--- + zipp.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zipp.py b/zipp.py +index 918e688..8cdfdc0 100644 +--- a/zipp.py ++++ b/zipp.py +@@ -159,7 +159,7 @@ class Path: + + @property + def parent(self): +- parent_at = posixpath.dirname(self.at) ++ parent_at = posixpath.dirname(self.at.rstrip('/')) + if parent_at: + parent_at += '/' + return self._next(parent_at) +-- +2.33.0 + diff --git a/python-zipp.spec b/python-zipp.spec index 458969b..bff0727 100644 --- a/python-zipp.spec +++ b/python-zipp.spec @@ -1,10 +1,14 @@ Name: python-zipp Version: 0.5.1 -Release: 2 +Release: 3 Summary: Backport of pathlib-compatible object wrapper for zip files License: MIT URL: https://github.com/jaraco/zipp Source0: https://files.pythonhosted.org/packages/f9/c4/15a1260171956ed4f8190962b1771c7dbca4a39360c15f9c2b77e667a489/zipp-0.5.1.tar.gz + +Patch0: backport-Add-test-capturing-failure-to-traverse-parent-of-a-d.patch +Patch1: backport-Strip-the-trailing-slash-from-directory-entries.-Fix.patch + BuildArch: noarch BuildRequires: python3-devel python3-setuptools BuildRequires: python3-setuptools_scm >= 1.15.0 @@ -44,6 +48,9 @@ A pathlib-compatible Zipfile object wrapper. A backport of the Path object. %doc README.rst %changelog +* Mon Aug 12 2024 zhangruifang - 0.5.1-3 +- backport patch from upstream + * Wed Dec 16 2020 zhanzhimin - 0.5.1-2 - Update Source0 -- Gitee