Skip to content

Commit 704d119

Browse files
dipre-commit-ci[bot]mayeut
authored
Sort compressed tag sets when rewriting wheel filename (#584)
* Always sort platform tags * Update tests --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Matthieu Darbois <[email protected]>
1 parent 8628e84 commit 704d119

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/auditwheel/wheeltools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def add_platforms(
242242

243243
fparts = {
244244
"prefix": wheel_fname.rsplit("-", maxsplit=1)[0],
245-
"plat": ".".join(fname_tags),
245+
"plat": ".".join(sorted(fname_tags)),
246246
"ext": splitext(wheel_fname)[1],
247247
}
248248
out_wheel_fname = "{prefix}-{plat}{ext}".format(**fparts)

tests/integration/test_manylinux.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,12 @@ def anylinux(
461461

462462
with docker_container_ctx(manylinux_img, io_folder, env) as container:
463463
platform_tag = ".".join(
464-
[f"{p}_{PLATFORM}" for p in [policy, *POLICY_ALIASES.get(policy, [])]]
464+
sorted(
465+
[
466+
f"{p}_{PLATFORM}"
467+
for p in [policy, *POLICY_ALIASES.get(policy, [])]
468+
]
469+
)
465470
)
466471
yield AnyLinuxContainer(
467472
f"{policy}_{PLATFORM}", platform_tag, container, io_folder
@@ -813,9 +818,9 @@ def test_cross_repair(
813818
else:
814819
assert libc == Libc.GLIBC
815820
source = "glibc"
816-
platform_tag = f"manylinux_2_17_{arch.value}.manylinux2014_{arch.value}"
821+
platform_tag = f"manylinux2014_{arch.value}.manylinux_2_17_{arch.value}"
817822
if arch in {Architecture.x86_64, Architecture.i686}:
818-
platform_tag = f"manylinux_2_5_{arch.value}.manylinux1_{arch.value}"
823+
platform_tag = f"manylinux1_{arch.value}.manylinux_2_5_{arch.value}"
819824
elif arch == Architecture.riscv64:
820825
platform_tag = f"manylinux_2_31_{arch.value}"
821826
python_abi = "cp313-cp313"
@@ -939,24 +944,26 @@ def test_compat(
939944

940945
if PLATFORM in {"x86_64", "i686"}:
941946
expect = f"manylinux_2_5_{PLATFORM}"
942-
expect_tag = f"manylinux_2_5_{PLATFORM}.manylinux1_{PLATFORM}"
947+
expect_tag = f"manylinux1_{PLATFORM}.manylinux_2_5_{PLATFORM}"
943948
else:
944949
expect = f"manylinux_2_17_{PLATFORM}"
945-
expect_tag = f"manylinux_2_17_{PLATFORM}.manylinux2014_{PLATFORM}"
950+
expect_tag = f"manylinux2014_{PLATFORM}.manylinux_2_17_{PLATFORM}"
946951

947952
target_tag = target_policy
948953
for pep600_policy, aliases in POLICY_ALIASES.items():
949954
policy_ = f"{pep600_policy}_{PLATFORM}"
950955
aliases_ = [f"{p}_{PLATFORM}" for p in aliases]
951956
if target_policy == policy_ or target_policy in aliases_:
952-
target_tag = f"{policy_}.{'.'.join(aliases_)}"
957+
target_tag = ".".join(sorted([policy_, *aliases_]))
953958

954959
# we shall ba able to repair the wheel for all targets
955960
anylinux.repair(orig_wheel, plat=target_policy, only_plat=only_plat)
956961
if only_plat or target_tag == expect_tag:
957962
repaired_tag = target_tag
958963
else:
959-
repaired_tag = f"{expect_tag}.{target_tag}"
964+
repaired_tag = ".".join(
965+
sorted(expect_tag.split(".") + target_tag.split("."))
966+
)
960967
repaired_wheel = anylinux.check_wheel("testsimple", platform_tag=repaired_tag)
961968

962969
assert_show_output(anylinux, repaired_wheel, expect, True)

0 commit comments

Comments
 (0)