diff --git a/src/auditwheel/main_repair.py b/src/auditwheel/main_repair.py index a89de776..3b788bad 100644 --- a/src/auditwheel/main_repair.py +++ b/src/auditwheel/main_repair.py @@ -78,6 +78,13 @@ def configure_parser(sub_parsers): ), default=True, ) + p.add_argument( + "--no-set-soname", + dest="SET_SONAME", + action="store_false", + help="Move and rename libraries but don't set their SONAME", + default=True, + ) p.add_argument( "--strip", dest="STRIP", @@ -176,6 +183,7 @@ def execute(args, p): lib_sdir=args.LIB_SDIR, out_dir=args.WHEEL_DIR, update_tags=args.UPDATE_TAGS, + set_soname=args.SET_SONAME, patcher=patcher, exclude=args.EXCLUDE, strip=args.STRIP, diff --git a/src/auditwheel/repair.py b/src/auditwheel/repair.py index c172b471..771dd61a 100644 --- a/src/auditwheel/repair.py +++ b/src/auditwheel/repair.py @@ -38,6 +38,7 @@ def repair_wheel( lib_sdir: str, out_dir: str, update_tags: bool, + set_soname: bool, patcher: ElfPatcher, exclude: list[str], strip: bool = False, @@ -85,7 +86,7 @@ def repair_wheel( % soname ) - new_soname, new_path = copylib(src_path, dest_dir, patcher) + new_soname, new_path = copylib(src_path, dest_dir, patcher, set_soname) soname_map[soname] = (new_soname, new_path) replacements.append((soname, new_soname)) if replacements: @@ -126,7 +127,9 @@ def strip_symbols(libraries: Iterable[str]) -> None: check_call(["strip", "-s", lib]) -def copylib(src_path: str, dest_dir: str, patcher: ElfPatcher) -> tuple[str, str]: +def copylib( + src_path: str, dest_dir: str, patcher: ElfPatcher, set_soname: bool +) -> tuple[str, str]: """Graft a shared library from the system into the wheel and update the relevant links. @@ -160,7 +163,8 @@ def copylib(src_path: str, dest_dir: str, patcher: ElfPatcher) -> tuple[str, str if not statinfo.st_mode & stat.S_IWRITE: os.chmod(dest_path, statinfo.st_mode | stat.S_IWRITE) - patcher.set_soname(dest_path, new_soname) + if set_soname: + patcher.set_soname(dest_path, new_soname) if any(itertools.chain(rpaths["rpaths"], rpaths["runpaths"])): patcher.set_rpath(dest_path, dest_dir) diff --git a/tests/integration/test_bundled_wheels.py b/tests/integration/test_bundled_wheels.py index bf2454b5..2eb9df59 100644 --- a/tests/integration/test_bundled_wheels.py +++ b/tests/integration/test_bundled_wheels.py @@ -71,6 +71,7 @@ def test_wheel_source_date_epoch(tmp_path, monkeypatch): PLAT="manylinux_2_5_x86_64", STRIP=False, UPDATE_TAGS=True, + SET_SONAME=True, WHEEL_DIR=str(wheel_output_path), WHEEL_FILE=[str(wheel_path)], EXCLUDE=[],