From fbdd62e9423191ebe706bfbe695cc971e9bfbdf1 Mon Sep 17 00:00:00 2001 From: Matthieu Darbois Date: Sat, 14 Dec 2024 18:36:41 +0100 Subject: [PATCH] do not add zip file entries for non-empty directories Co-authored-by: Lisandro Dalcin --- src/auditwheel/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auditwheel/tools.py b/src/auditwheel/tools.py index 29c8ef50..24b3e8e3 100644 --- a/src/auditwheel/tools.py +++ b/src/auditwheel/tools.py @@ -121,7 +121,7 @@ def dir2zip(in_dir: str, zip_fname: str, date_time: datetime | None = None) -> N compression = zipfile.ZIP_DEFLATED with zipfile.ZipFile(zip_fname, "w", compression=compression) as z: for root, dirs, files in walk(in_dir): - if root != in_dir: + if root != in_dir and not (dirs or files): dname = root out_dname = os.path.relpath(dname, in_dir) + "/" zinfo = zipfile.ZipInfo.from_file(dname, out_dname)