From dc05218b26b308e38e4bded6a03e14779d208566 Mon Sep 17 00:00:00 2001 From: pvallet Date: Tue, 2 Jan 2024 08:46:57 +0100 Subject: [PATCH 1/4] Added the option to skip setting library SONAMEs --- src/auditwheel/main_repair.py | 8 ++++++++ src/auditwheel/repair.py | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/auditwheel/main_repair.py b/src/auditwheel/main_repair.py index a89de776..1137df83 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", + "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..ac34b268 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,7 @@ 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 +161,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) From 8075b212098396803b31aa896fb7a2b9d3935be8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 07:50:45 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/auditwheel/repair.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/auditwheel/repair.py b/src/auditwheel/repair.py index ac34b268..771dd61a 100644 --- a/src/auditwheel/repair.py +++ b/src/auditwheel/repair.py @@ -127,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, set_soname: bool) -> 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. From aa100d46d3bae79cf03ea1262d8c815d201db528 Mon Sep 17 00:00:00 2001 From: pvallet Date: Tue, 2 Jan 2024 09:03:13 +0100 Subject: [PATCH 3/4] Fixed missing argument --- src/auditwheel/main_repair.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auditwheel/main_repair.py b/src/auditwheel/main_repair.py index 1137df83..3b788bad 100644 --- a/src/auditwheel/main_repair.py +++ b/src/auditwheel/main_repair.py @@ -80,7 +80,7 @@ def configure_parser(sub_parsers): ) p.add_argument( "--no-set-soname", - "SET_SONAME", + dest="SET_SONAME", action="store_false", help="Move and rename libraries but don't set their SONAME", default=True, From de6ecb3fa6858f01ddc651fbdae1243f16a794b2 Mon Sep 17 00:00:00 2001 From: pvallet Date: Tue, 2 Jan 2024 15:06:19 +0100 Subject: [PATCH 4/4] Fixing a broken test --- tests/integration/test_bundled_wheels.py | 1 + 1 file changed, 1 insertion(+) 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=[],