Skip to content

Commit d6e5b69

Browse files
authored
fix: don't create empty .libs directory (#489)
1 parent e969b7b commit d6e5b69

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/auditwheel/repair.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ def repair_wheel(
6464

6565
dest_dir = match.group("name") + lib_sdir
6666

67-
if not exists(dest_dir):
68-
os.mkdir(dest_dir)
69-
7067
# here, fn is a path to an ELF file (lib or executable) in
7168
# the wheel, and v['libs'] contains its required libs
7269
for fn, v in external_refs_by_fn.items():
@@ -84,6 +81,8 @@ def repair_wheel(
8481
% soname
8582
)
8683

84+
if not exists(dest_dir):
85+
os.mkdir(dest_dir)
8786
new_soname, new_path = copylib(src_path, dest_dir, patcher)
8887
soname_map[soname] = (new_soname, new_path)
8988
replacements.append((soname, new_soname))

tests/integration/test_manylinux.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
logger = logging.getLogger(__name__)
2222

23-
2423
ENCODING = "utf-8"
2524
PLATFORM = get_arch_name()
2625
MANYLINUX1_IMAGE_ID = f"quay.io/pypa/manylinux1_{PLATFORM}:latest"
@@ -1000,8 +999,15 @@ def test_build_wheel_compat(
1000999
repaired_tag = f"{expect_tag}.{target_tag}"
10011000
repaired_wheel = f"testsimple-0.0.1-{PYTHON_ABI}-{repaired_tag}.whl"
10021001
assert repaired_wheel in filenames
1002+
10031003
assert_show_output(manylinux_ctr, repaired_wheel, expect, True)
10041004

1005+
with zipfile.ZipFile(os.path.join(io_folder, repaired_wheel)) as z:
1006+
for file in z.namelist():
1007+
assert not file.startswith(
1008+
"testsimple.libs"
1009+
), "should not have empty .libs folder"
1010+
10051011
docker_exec(docker_python, f"pip install /io/{repaired_wheel}")
10061012
docker_exec(
10071013
docker_python,

0 commit comments

Comments
 (0)