diff --git a/scripts/fix-wheels.py b/scripts/fix-wheels.py index c8ed62c..3056d4e 100644 --- a/scripts/fix-wheels.py +++ b/scripts/fix-wheels.py @@ -10,6 +10,7 @@ import sys import pathlib import sysconfig +import platform from wheel.cli.tags import tags @@ -18,9 +19,15 @@ def main(wheel_dir): # PyPi rejects non-manylinux wheels. Change the tag according to PEP-513 if platform_tag.startswith("linux"): platform_tag = platform_tag.replace("linux", "manylinux1") + if platform_tag.startswith("macosx"): + print(f"platform: {platform.machine()}") + if platform.machine() == "x86_64": + platform_tag = platform_tag.replace("universal2", "x86_64") + else: + platform_tag = platform_tag.replace("universal2", "arm64") for f in pathlib.Path(wheel_dir).glob("**/*"): print("Processing file: {}".format(f.name)) - if f.name.endswith("any.whl") or f.name.endswith("universal2.whl"): + if f.name.endswith("any.whl"): print(f"Fixing wheel {f.name} with new tag {platform_tag}") tags(str(f.absolute()), None, None, platform_tag, None, True)