From 9c208055ef001be924667be456afc522a4fd3a2f Mon Sep 17 00:00:00 2001 From: Peter Pham Date: Wed, 9 Oct 2024 17:02:01 -0700 Subject: [PATCH] lint and fix comment --- src/auditwheel/main_repair.py | 2 +- tests/integration/test_manylinux.py | 51 +++++++++++++++++----------- tests/integration/testrpath/setup.py | 5 +-- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/auditwheel/main_repair.py b/src/auditwheel/main_repair.py index 9bcd0388..07faca87 100644 --- a/src/auditwheel/main_repair.py +++ b/src/auditwheel/main_repair.py @@ -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() diff --git a/tests/integration/test_manylinux.py b/tests/integration/test_manylinux.py index 860c7474..55a670e9 100644 --- a/tests/integration/test_manylinux.py +++ b/tests/integration/test_manylinux.py @@ -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) @@ -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"]) + # Test case 1: Exclude liba.so and libx.so using 2 --exclude parameters + 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 diff --git a/tests/integration/testrpath/setup.py b/tests/integration/testrpath/setup.py index fc043cd7..7264fc6e 100644 --- a/tests/integration/testrpath/setup.py +++ b/tests/integration/testrpath/setup.py @@ -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"], ) ], )