Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the option to skip setting library SONAMEs #472

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/auditwheel/main_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions src/auditwheel/repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_bundled_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[],
Expand Down