File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,18 @@ if is_Monterey || is_BigSur; then
77 echo " Install latest Python 2"
88 Python2Url=" https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg"
99 download_with_retries $Python2Url " /tmp" " python2.pkg"
10- sudo installer -pkg /tmp/python2.pkg -target /
10+
11+ sudo installer -showChoiceChangesXML -pkg /tmp/python2.pkg -target / > /tmp/python2_choices.xml
12+
13+ # To avoid symlink conflicts, remove tools installation in /usr/local/bin using installer choices
14+ xmllint --shell /tmp/python2_choices.xml << EOF
15+ cd //array/dict[string[text()='org.python.Python.PythonUnixTools-2.7']]/integer
16+ set 0
17+ save
18+ EOF
19+
20+ sudo installer -applyChoiceChangesXML /tmp/python2_choices.xml -pkg /tmp/python2.pkg -target /
21+
1122 pip install --upgrade pip
1223
1324 echo " Install Python2 certificates"
@@ -19,10 +30,8 @@ if is_Veertu; then
1930 close_finder_window
2031fi
2132
22- # Explicitly overwrite symlinks created by Python2 such as /usr/local/bin/2to3 since they conflict with symlinks from Python3
23- # https://github.com/actions/runner-images/issues/2322
2433echo " Brew Installing Python 3"
25- brew_smart_install " python@3.11" || brew link --overwrite python@3.11
34+ brew_smart_install " python@3.11"
2635
2736echo " Installing pipx"
2837export PIPX_BIN_DIR=/usr/local/opt/pipx_bin
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ function Get-PipVersion {
129129 [int ] $Version
130130 )
131131
132- $command = If ($Version -eq 2 ) { " pip --version" } Else { " pip3 --version" }
132+ $command = If ($Version -eq 2 ) { " /Library/Frameworks/Python.framework/Versions/2.7/bin/ pip --version" } Else { " pip3 --version" }
133133 $commandOutput = Run- Command $command
134134 $versionPart1 = $commandOutput | Take- Part - Part 1
135135 $versionPart2 = $commandOutput | Take- Part - Part 4
@@ -192,7 +192,7 @@ function Get-PerlVersion {
192192}
193193
194194function Get-PythonVersion {
195- $pythonVersion = Run- Command " python --version"
195+ $pythonVersion = Run- Command " /Library/Frameworks/Python.framework/Versions/2.7/bin/ python --version"
196196 return ($pythonVersion -replace " ^Python" ).Trim()
197197}
198198
Original file line number Diff line number Diff line change @@ -30,19 +30,11 @@ Describe "Python3" -Skip:($os.IsVenturaArm64) {
3030
3131Describe " Python2" - Skip:($os.IsVenturaArm64 -or $os.IsVentura ) {
3232 It " Python 2 is available" {
33- " python --version" | Should - ReturnZeroExitCode
34- }
35-
36- It " Python 2 is real 2.x" {
37- (Get-CommandResult " python --version" ).Output | Should - BeLike " Python 2.*"
38- }
39-
40- It " Python 2 is installed under /usr/local/bin" {
41- Get-WhichTool " python" | Should - BeLike " /usr/local/bin*"
33+ " /Library/Frameworks/Python.framework/Versions/2.7/bin/python --version" | Should - ReturnZeroExitCode
4234 }
4335
4436 It " Pip 2 is available" {
45- " pip --version" | Should - ReturnZeroExitCode
37+ " /Library/Frameworks/Python.framework/Versions/2.7/bin/ pip --version" | Should - ReturnZeroExitCode
4638 }
4739
4840 It " 2to3 symlink does not point to Python 2" {
You can’t perform that action at this time.
0 commit comments