From 36933f0800bc45390726849bb36e143f730c69b2 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Tue, 22 Aug 2023 09:59:20 +1200 Subject: [PATCH 1/3] Skip adding directories to RECORD with `wheel tags` --- docs/news.rst | 2 ++ src/wheel/cli/tags.py | 2 ++ tests/cli/test_tags.py | 16 ++++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/news.rst b/docs/news.rst index 9f65f030..eb9f0ead 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -5,6 +5,8 @@ Release Notes - Fixed platform tag detection for GraalPy and 32-bit python running on an aarch64 kernel (PR by Matthieu Darbois) +- Fixed ``wheel tags`` to not list directories in ``RECORD`` files + (PR by Mike Taves) **0.41.1 (2023-08-05)** diff --git a/src/wheel/cli/tags.py b/src/wheel/cli/tags.py index b9094d79..833687c7 100644 --- a/src/wheel/cli/tags.py +++ b/src/wheel/cli/tags.py @@ -120,6 +120,8 @@ def tags( ) as fout: fout.comment = fin.comment # preserve the comment for item in fin.infolist(): + if item.is_dir(): + continue if item.filename == f.dist_info_path + "/RECORD": continue if item.filename == f.dist_info_path + "/WHEEL": diff --git a/tests/cli/test_tags.py b/tests/cli/test_tags.py index 24541495..8fea1d49 100644 --- a/tests/cli/test_tags.py +++ b/tests/cli/test_tags.py @@ -222,11 +222,15 @@ def test_permission_bits(capsys, wheelpath): with ZipFile(str(output_file), "r") as outf: with ZipFile(str(wheelpath), "r") as inf: for member in inf.namelist(): - if not member.endswith("/RECORD"): - out_attr = outf.getinfo(member).external_attr - inf_attr = inf.getinfo(member).external_attr - assert ( - out_attr == inf_attr - ), f"{member} 0x{out_attr:012o} != 0x{inf_attr:012o}" + member_info = inf.getinfo(member) + if member_info.is_dir(): + continue + if member_info.filename.endswith("/RECORD"): + continue + out_attr = outf.getinfo(member).external_attr + inf_attr = member_info.external_attr + assert ( + out_attr == inf_attr + ), f"{member} 0x{out_attr:012o} != 0x{inf_attr:012o}" output_file.unlink() From 5eddb894c8abb1701bddc38304158a8fa34c9716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Tue, 22 Aug 2023 01:33:19 +0300 Subject: [PATCH 2/3] Update test_tags.py --- tests/cli/test_tags.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/cli/test_tags.py b/tests/cli/test_tags.py index 8fea1d49..23fbd09d 100644 --- a/tests/cli/test_tags.py +++ b/tests/cli/test_tags.py @@ -225,8 +225,10 @@ def test_permission_bits(capsys, wheelpath): member_info = inf.getinfo(member) if member_info.is_dir(): continue + if member_info.filename.endswith("/RECORD"): continue + out_attr = outf.getinfo(member).external_attr inf_attr = member_info.external_attr assert ( From 2a200a32107de919e40091fa0f7566cc7d1f7c91 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 22:33:26 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/cli/test_tags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cli/test_tags.py b/tests/cli/test_tags.py index 23fbd09d..cf67c092 100644 --- a/tests/cli/test_tags.py +++ b/tests/cli/test_tags.py @@ -225,7 +225,7 @@ def test_permission_bits(capsys, wheelpath): member_info = inf.getinfo(member) if member_info.is_dir(): continue - + if member_info.filename.endswith("/RECORD"): continue