Skip to content

Commit 3cd1a03

Browse files
committed
ci: Force Homebrew to overwrite the image Python
We don't care about system Python, as we use `actions/setup-python` (on GitHub) or `UsePythonVersion` (on Azure), which install in some other location and adjust the `PATH`. But occasionally, Homebrew will fail to update these files because they didn't come from Homebrew, so just silence its complaints.
1 parent acb461f commit 3cd1a03

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,17 @@ jobs:
188188
;;
189189
macOS)
190190
brew update
191-
export HOMEBREW_NO_INSTALL_UPGRADE=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
191+
# Periodically, Homebrew updates Python and fails to overwrite the
192+
# existing not-managed-by-Homebrew copy without explicitly being told
193+
# to do so. GitHub/Azure continues to avoid fixing their runner images:
194+
# https://github.com/actions/runner-images/issues/9966
195+
# so force an overwrite even if there are no Python updates.
196+
# We don't even care about Homebrew's Python because we use the one
197+
# from actions/setup-python.
198+
for python_package in $(brew list | grep python@); do
199+
brew unlink ${python_package}
200+
brew link --overwrite ${python_package}
201+
done
192202
brew install ccache ghostscript gobject-introspection gtk4 ninja
193203
brew install --cask font-noto-sans-cjk inkscape
194204
;;

azure-pipelines.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,17 @@ stages:
111111
;;
112112
Darwin)
113113
brew update
114-
export HOMEBREW_NO_INSTALL_UPGRADE=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
114+
# Periodically, Homebrew updates Python and fails to overwrite the
115+
# existing not-managed-by-Homebrew copy without explicitly being told
116+
# to do so. GitHub/Azure continues to avoid fixing their runner images:
117+
# https://github.com/actions/runner-images/issues/9966
118+
# so force an overwrite even if there are no Python updates.
119+
# We don't even care about Homebrew's Python because we use the one
120+
# from UsePythonVersion.
121+
for python_package in $(brew list | grep python@); do
122+
brew unlink ${python_package}
123+
brew link --overwrite ${python_package}
124+
done
115125
brew install --cask xquartz
116126
brew install ccache ffmpeg imagemagick mplayer ninja pkg-config
117127
brew install --cask font-noto-sans-cjk-sc

0 commit comments

Comments
 (0)