From 2ad579bbf4c49dfe87b5f24fef0cbeea20861284 Mon Sep 17 00:00:00 2001 From: Ludwig Schwardt Date: Mon, 1 Jul 2024 16:39:53 +0200 Subject: [PATCH] Enforce Homebrew Python on Intel macOS runners It appears that GitHub runners come with an extra "framework" Python symlinked into /usr/local. On arm64 runners this has no effect, since the Homebrew prefix has changed to /opt/homebrew. On x86_64 runners, however, Homebrew still lives in /usr/local and this is probably why CMake can't find the right Python. Try the minimum workaround first. --- .github/workflows/osx.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 611eed1..fc78485 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -18,18 +18,22 @@ jobs: continue-on-error: true steps: - - name: checkout + - name: Checkout uses: actions/checkout@v4 with: # Needed for `setuptools-scm` fetch-depth: 0 - - name: install homebrew packages + # See https://github.com/orgs/Homebrew/discussions/3895#discussioncomment-4130560 + - name: Ensure we use Homebrew Python + run: find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete + + - name: Install Homebrew packages run: | brew tap casacore/tap brew install casacore - - name: make virtualenv + - name: Make virtualenv # XXX Use Homebrew's numpy to be safe for now, especially since # PyPI is now on numpy 2.0, which complicates matters run: python3 -m venv venv --system-site-packages @@ -43,7 +47,7 @@ jobs: - name: Run pytest run: cd tests && ../venv/bin/pytest - - name: make binary wheel + - name: Make binary wheel run: venv/bin/pip wheel -w dist . - name: Delocate binary wheel