Skip to content

Commit 9b851b5

Browse files
jamessanmikesart
authored andcommitted
ci(gha/win): Do not rename python.exe to python3.exe if it exists
GHA now provides python3.exe by default -- actions/python-versions#78 Ensure Python 2 directory is earlier in $PATH so bare python always invokes Python 2.
1 parent 8ce21b2 commit 9b851b5

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎ci/build.ps1‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,14 @@ elseif ($compiler -eq 'MSVC') {
8888
if (-not $NoTests) {
8989
# Setup python (use AppVeyor system python)
9090

91-
C:\hostedtoolcache\windows\Python\2.7.18\x64\python.exe -m pip install pynvim ; exitIfFailed
92-
C:\hostedtoolcache\windows\Python\3.5.4\x64\python.exe -m pip install pynvim ; exitIfFailed
93-
# Disambiguate python3
94-
move C:\hostedtoolcache\windows\Python\3.5.4\x64\python.exe C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe
95-
$env:PATH = "C:\hostedtoolcache\windows\Python\3.5.4\x64;C:\hostedtoolcache\windows\Python\2.7.18\x64;$env:PATH"
91+
# Disambiguate python3, if needed
92+
if (-not (Test-Path -Path C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe) ) {
93+
move C:\hostedtoolcache\windows\Python\3.5.4\x64\python.exe C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe
94+
}
95+
$env:PATH = "C:\hostedtoolcache\windows\Python\2.7.18\x64;C:\hostedtoolcache\windows\Python\3.5.4\x64;$env:PATH"
96+
97+
python -m pip install pynvim ; exitIfFailed
98+
python3 -m pip install pynvim ; exitIfFailed
9699
# Sanity check
97100
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
98101
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed

0 commit comments

Comments
 (0)