Skip to content

Commit c6874fb

Browse files
Dynamically find the Python3 dir on Windows
Windows installers place each version of Python in their own, uniquely named directory. Can't programatically override w/free Chocolatey, so use the shell and figure it where it installed it dynamically.
1 parent 2a5d215 commit c6874fb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/common.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,12 @@ function install_ide()
166166
local debug=$3
167167
if [ "$WINDOWS" = "1" ]; then
168168
# Acquire needed packages from Windows package manager
169-
choco install --no-progress python3
170-
export PATH="/c/Python37:$PATH" # Ensure it's live from now on...
171-
cp /c/Python37/python.exe /c/Python37/python3.exe
169+
choco install --no-progress python3 >& pylog.txt
170+
# Parse the python instrall dir from the output log. Sorry, can't set it via choco on the free version
171+
PYDIR=$(cat pylog.txt | grep "^Installed to:" | cut -f2 -d"'" | sed 's/C:\\/\/c\//')
172+
echo "Detected python3 install dir: $PYDIR"
173+
export PATH="$PYDIR:$PATH" # Ensure it's live from now on...
174+
cp "$PYDIR/python.exe" "$PYDIR/python3.exe"
172175
choco install --no-progress unzip
173176
choco install --no-progress sed
174177
#choco install --no-progress golang

0 commit comments

Comments
 (0)