From 707784ceec79febdce82eff289bcbb616f8f8ffe Mon Sep 17 00:00:00 2001 From: Richard Si Date: Sat, 20 Dec 2025 10:31:26 -0500 Subject: [PATCH] Write WHEEL tags in expanded form The wheel specification requires that the Tag field contains all of the tags in their expanded form. Leaving the compressed form unchanged is usually "fine", but pip check (only!) misidentifies the wheel as incompatible with the system when fed a compressed wheel tag set. --- make_wheels.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/make_wheels.py b/make_wheels.py index d20fd39..b9697ed 100644 --- a/make_wheels.py +++ b/make_wheels.py @@ -91,6 +91,17 @@ def write_wheel(out_dir, *, name, version, tag, metadata, description, contents) for header, value in metadata: filtered_metadata.append((header, value)) + # The WHEEL file must contain the compatibility tags in their expanded form. + # see https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-contents + # see https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#compressed-tag-sets + pytag, abitag, platformtag = tag.split("-") + expanded_tags = [ + "-".join((x, y, z)) + for z in platformtag.split(".") + for y in abitag.split(".") + for x in pytag.split(".") + ] + return write_wheel_file(os.path.join(out_dir, wheel_name), { **contents, f'{dist_info}/entry_points.txt': make_message([], @@ -106,7 +117,7 @@ def write_wheel(out_dir, *, name, version, tag, metadata, description, contents) ('Wheel-Version', '1.0'), ('Generator', 'ziglang make_wheels.py'), ('Root-Is-Purelib', 'false'), - ('Tag', tag), + ('Tag', expanded_tags), ]), })