[macOS] Update Python script and Python3 symlink behaviour (#13174)

This commit is contained in:
Erik Bershel
2025-10-16 12:34:30 +02:00
committed by GitHub
parent 3ae94865d0
commit 2f702974cc
6 changed files with 16 additions and 19 deletions

View File

@@ -54,4 +54,13 @@ foreach ($tool in $tools) {
}
}
# Ensure python3 and pip3 point to the latest installed Python version
# Fix for ./setup.sh script behavior for python3 and pip3 symlinks
# Only Intel images are affected since /usr/local/bin is used for Intel
# ARM images use /opt/homebrew/bin which is managed by Homebrew
Write-Host "Ensuring python3 and pip3 point to the latest installed Python version from Homebrew"
brew unlink python@3.14 && brew link python@3.14 --force --overwrite
Split-Path (readlink (which python3))
Invoke-PesterTests "Toolcache"

View File

@@ -12,16 +12,8 @@ echo "Installing Python Tooling"
close_finder_window
# Installing latest Homebrew Python 3 to handle python3 and pip3 symlinks
# When latest Python3 is installed as a dependency for other packages
# it does not create /usr/local/bin/python3 and /usr/local/bin/pip3
echo "Brew Installing default Python 3"
brew_smart_install "python"
# Install specific Python version
# Update symlinks for python3 and pip3 to point to the specific version
toolsetVersion=$(get_toolset_value '.python.default')
echo "Installing Python $toolsetVersion"
brew_smart_install "python@$toolsetVersion"
brew_smart_install "python3"
# Pipx has its own Python dependency
echo "Installing pipx"

View File

@@ -26,10 +26,15 @@ Describe "Python3" {
"pipx --version" | Should -ReturnZeroExitCode
}
It "Pip 3 and Python 3 came from the same brew formula" {
It "Pip 3 and Python 3 came from the same path prefix" {
$pip3Path = Split-Path (readlink (which pip3))
$python3Path = Split-Path (readlink (which python3))
$pip3Path | Should -BeExactly $python3Path
}
It "Pip 3 and Python 3 came from brew formula" {
Split-Path (readlink (which pip3)) | Should -BeLike "*/Cellar/*"
Split-Path (readlink (which python3)) | Should -BeLike "*/Cellar/*"
}
}

View File

@@ -222,9 +222,6 @@
"fastlane"
]
},
"python": {
"default": "3.13"
},
"toolcache": [
{
"name": "Python",

View File

@@ -226,9 +226,6 @@
"fastlane"
]
},
"python": {
"default": "3.13"
},
"toolcache": [
{
"name": "Python",

View File

@@ -130,9 +130,6 @@
"fastlane"
]
},
"python": {
"default": "3.13"
},
"toolcache": [
{
"name": "Python",