Skip to content

Commit 6fb620a

Browse files
committed
remove the DT_NEEDED entry rather than replacing with an empty one
1 parent 43706ff commit 6fb620a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/auditwheel/patcher.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class ElfPatcher:
1111
def replace_needed(self, file_name: Path, *old_new_pairs: tuple[str, str]) -> None:
1212
raise NotImplementedError()
1313

14+
def remove_needed(self, file_name: Path, *sonames: str) -> None:
15+
raise NotImplementedError()
16+
1417
def set_soname(self, file_name: Path, new_so_name: str) -> None:
1518
raise NotImplementedError()
1619

@@ -57,6 +60,15 @@ def replace_needed(self, file_name: Path, *old_new_pairs: tuple[str, str]) -> No
5760
]
5861
)
5962

63+
def remove_needed(self, file_name: Path, *sonames: str) -> None:
64+
check_call(
65+
[
66+
"patchelf",
67+
*chain.from_iterable(("--remove-needed", soname) for soname in sonames),
68+
file_name,
69+
]
70+
)
71+
6072
def set_soname(self, file_name: Path, new_so_name: str) -> None:
6173
check_call(["patchelf", "--set-soname", new_so_name, file_name])
6274

src/auditwheel/repair.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,12 @@ def repair_wheel(
7474
for soname, src_path in ext_libs.items():
7575
# Handle libpython dependencies by removing them
7676
if LIBPYTHON_RE.match(soname):
77-
logger.info("Removing libpython dependency %s from %s", soname, fn)
78-
patcher.replace_needed(fn, (soname, ""))
77+
logger.warning(
78+
"Removing libpython dependency %s from %s, libpython shall not be linked for CPython extensions on Linux",
79+
soname,
80+
fn,
81+
)
82+
patcher.remove_needed(fn, soname)
7983
continue
8084

8185
if src_path is None:

0 commit comments

Comments
 (0)