Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 9, 2024
1 parent cc79c8a commit 77144a9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/auditwheel/main_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def execute(args, p):

# Split comma separated values and flatten it
exclude = frozenset(
item.strip() for sublist in args.EXCLUDE for item in sublist.split(',')
item.strip() for sublist in args.EXCLUDE for item in sublist.split(",")
)

wheel_policy = WheelPolicies()
Expand Down
49 changes: 31 additions & 18 deletions tests/integration/test_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,27 +330,33 @@ def test_repair_exclude(self, any_manylinux_container, io_folder):
assert "manylinux" not in orig_wheel

def run_repair_test(exclude_args, expected_exclusions):
repair_command = [
f"LD_LIBRARY_PATH={test_path}/a:$LD_LIBRARY_PATH",
"auditwheel",
"repair",
f"--plat={policy}",
"--only-plat",
"-w",
"/io",
] + exclude_args + [
f"/io/{orig_wheel}",
]
output = docker_exec(manylinux_ctr, ["bash", "-c", " ".join(repair_command)])
repair_command = (
[
f"LD_LIBRARY_PATH={test_path}/a:$LD_LIBRARY_PATH",
"auditwheel",
"repair",
f"--plat={policy}",
"--only-plat",
"-w",
"/io",
]
+ exclude_args
+ [
f"/io/{orig_wheel}",
]
)
output = docker_exec(
manylinux_ctr, ["bash", "-c", " ".join(repair_command)]
)

# Check for exclusions in the output
for arg in exclude_args:
if ',' in arg:
libs = arg.split('=')[1].split(',')
if "," in arg:
libs = arg.split("=")[1].split(",")
for lib in libs:
assert f"Excluding {lib}" in output
else:
lib = arg.split('=')[1]
lib = arg.split("=")[1]
assert f"Excluding {lib}" in output

filenames = os.listdir(io_folder)
Expand All @@ -359,14 +365,21 @@ def run_repair_test(exclude_args, expected_exclusions):
assert repaired_wheel in filenames

# Make sure we don't have the excluded libraries in the result
contents = zipfile.ZipFile(os.path.join(io_folder, repaired_wheel)).namelist()
contents = zipfile.ZipFile(
os.path.join(io_folder, repaired_wheel)
).namelist()
for lib in expected_exclusions:
assert not any(x for x in contents if f"/{lib}" in x)

# Test case 1: Exclude liba.so only - it will exclude libb.so as well due to indirect reference
run_repair_test(["--exclude=liba.so", "--exclude=libx.so"], ["liba.so", "libb.so", "libx.so"])
run_repair_test(
["--exclude=liba.so", "--exclude=libx.so"],
["liba.so", "libb.so", "libx.so"],
)
# Test case 2: Exclude liba.so and libx.so using comma separated
run_repair_test(["--exclude=liba.so,libx.so"], ["liba.so", "libb.so", "libx.so"])
run_repair_test(
["--exclude=liba.so,libx.so"], ["liba.so", "libb.so", "libx.so"]
)

def test_build_wheel_with_binary_executable(
self, any_manylinux_container, docker_python, io_folder
Expand Down
5 changes: 1 addition & 4 deletions tests/integration/testrpath/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ def run(self) -> None:
include_dirs=["a", "x"],
libraries=["a", "x"],
library_dirs=["a", "x"],
extra_link_args=[
'-Wl,-rpath,$ORIGIN/../a',
'-Wl,-rpath,$ORIGIN/../x'
],
extra_link_args=["-Wl,-rpath,$ORIGIN/../a", "-Wl,-rpath,$ORIGIN/../x"],
)
],
)

0 comments on commit 77144a9

Please sign in to comment.