backport patch from upstream

This commit is contained in:
zhangruifang2020 2024-08-12 11:00:44 +08:00
parent a6b1494a4e
commit 225823f2f2
3 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From ae4be5a235e8952c0d9ee4900f801ff78bce357a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" <jaraco@jaraco.com>
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

View File

@ -0,0 +1,25 @@
From 3378887bce94da5372e89c93f101ef9c3f8edff4 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" <jaraco@jaraco.com>
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

View File

@ -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 <zhangruifang@h-partners.com> - 0.5.1-3
- backport patch from upstream
* Wed Dec 16 2020 zhanzhimin<zhanzhimin@huawei.com> - 0.5.1-2
- Update Source0