From 449b6bb1c87bc9fd94a13a023366211dfdf92ec0 Mon Sep 17 00:00:00 2001 From: Erik van den Brink Date: Tue, 11 Jun 2024 15:39:20 +0200 Subject: [PATCH] ci, scripts: fix OSX Intel builds --- .github/workflows/release-to-pypi.yml | 2 +- .github/workflows/validate-pr-commit.yml | 4 ++-- scripts/fix-wheels.py | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-to-pypi.yml b/.github/workflows/release-to-pypi.yml index f7328a8..32f22d3 100644 --- a/.github/workflows/release-to-pypi.yml +++ b/.github/workflows/release-to-pypi.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, windows-latest, macos-latest ] + os: [ ubuntu-20.04, windows-latest, macos-latest, macos-13 ] python-version: ["3.11"] steps: - name: restore artifact diff --git a/.github/workflows/validate-pr-commit.yml b/.github/workflows/validate-pr-commit.yml index 7c557a1..07a2b97 100644 --- a/.github/workflows/validate-pr-commit.yml +++ b/.github/workflows/validate-pr-commit.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, windows-latest, macos-latest ] + os: [ ubuntu-20.04, windows-latest, macos-latest, macos-13 ] python-version: ["3.11", "3.12"] steps: - name: Checkout code @@ -103,7 +103,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, windows-latest, macos-latest ] + os: [ ubuntu-20.04, windows-latest, macos-latest, macos-13 ] python-version: ["3.11", "3.12"] steps: - name: restore artifact diff --git a/scripts/fix-wheels.py b/scripts/fix-wheels.py index 4641f89..376ea62 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,6 +19,11 @@ 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"): + if platform.machine().lower() == "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("**/*"): if f.name.endswith("any.whl"): tags(str(f.absolute()), None, None, platform_tag, None, True)