Skip to content

Commit 8db479d

Browse files
committed
add test for "auto" platform
1 parent 5e1f238 commit 8db479d

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

src/auditwheel/main_repair.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def execute(args: argparse.Namespace, parser: argparse.ArgumentParser) -> int:
174174

175175
try:
176176
wheel_abi = analyze_wheel_abi(
177-
libc, arch, wheel_file, exclude, args.DISABLE_ISA_EXT_CHECK
177+
libc, arch, wheel_file, exclude, args.DISABLE_ISA_EXT_CHECK, True
178178
)
179179
except NonPlatformWheel as e:
180180
logger.info(e.message)

src/auditwheel/main_show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def execute(args: argparse.Namespace, parser: argparse.ArgumentParser) -> int:
5555

5656
try:
5757
winfo = analyze_wheel_abi(
58-
libc, arch, wheel_file, frozenset(), args.DISABLE_ISA_EXT_CHECK
58+
libc, arch, wheel_file, frozenset(), args.DISABLE_ISA_EXT_CHECK, False
5959
)
6060
except NonPlatformWheel as e:
6161
logger.info("%s", e.message)

src/auditwheel/wheel_abi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def analyze_wheel_abi(
323323
wheel_fn: Path,
324324
exclude: frozenset[str],
325325
disable_isa_ext_check: bool,
326+
allow_graft: bool,
326327
) -> WheelAbIInfo:
327328
data = get_wheel_elfdata(libc, architecture, wheel_fn, exclude)
328329
policies = data.policies
@@ -375,12 +376,13 @@ def analyze_wheel_abi(
375376

376377
overall_policy = min(
377378
symbol_policy,
378-
ref_policy,
379379
ucs_policy,
380380
pyfpe_policy,
381381
blacklist_policy,
382382
machine_policy,
383383
)
384+
if not allow_graft:
385+
overall_policy = min(overall_policy, ref_policy)
384386

385387
return WheelAbIInfo(
386388
policies,

tests/integration/test_bundled_wheels.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_analyze_wheel_abi(file, external_libs, exclude):
6868
importlib.reload(lddtree)
6969

7070
winfo = analyze_wheel_abi(
71-
Libc.GLIBC, Architecture.x86_64, HERE / file, exclude, False
71+
Libc.GLIBC, Architecture.x86_64, HERE / file, exclude, False, True
7272
)
7373
assert set(winfo.external_refs["manylinux_2_5_x86_64"].libs) == external_libs, (
7474
f"{HERE}, {exclude}, {os.environ}"
@@ -85,6 +85,7 @@ def test_analyze_wheel_abi_pyfpe():
8585
HERE / "fpewheel-0.0.0-cp35-cp35m-linux_x86_64.whl",
8686
frozenset(),
8787
False,
88+
True,
8889
)
8990
# for external symbols, it could get manylinux1
9091
assert winfo.sym_policy.name == "manylinux_2_5_x86_64"
@@ -101,6 +102,7 @@ def test_analyze_wheel_abi_bad_architecture():
101102
HERE / "fpewheel-0.0.0-cp35-cp35m-linux_x86_64.whl",
102103
frozenset(),
103104
False,
105+
True,
104106
)
105107

106108

tests/integration/test_manylinux.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,12 @@ def test_image_dependencies(
841841
)
842842

843843
# check all works properly when targeting the policy matching the image
844-
anylinux.repair(orig_wheel, only_plat=False, library_paths=[test_path])
844+
# use "auto" platform
845+
anylinux.repair(
846+
orig_wheel, only_plat=False, plat="auto", library_paths=[test_path]
847+
)
845848
repaired_wheel = anylinux.check_wheel("testdependencies")
849+
# we shall only get the current policy tag with "auto" platform
846850
assert_show_output(anylinux, repaired_wheel, policy_name, True)
847851

848852
# check the original wheel with a dependency was not compliant

0 commit comments

Comments
 (0)