From 3a1c52e77368a2bb7863d20be8f278080e4265ef Mon Sep 17 00:00:00 2001 From: CorpNewt <12772521+corpnewt@users.noreply.github.com> Date: Wed, 15 Jul 2020 15:55:09 -0500 Subject: [PATCH] Add support for py launcher --- MakeInstall.bat | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MakeInstall.bat b/MakeInstall.bat index a019ede..611af98 100644 --- a/MakeInstall.bat +++ b/MakeInstall.bat @@ -118,7 +118,7 @@ goto :EOF call :updatepath for /f "USEBACKQ tokens=*" %%x in (`!syspath!where.exe python 2^> nul`) do ( call :checkpyversion "%%x" "py2v" "py2path" "py3v" "py3path" ) for /f "USEBACKQ tokens=*" %%x in (`!syspath!where.exe python3 2^> nul`) do ( call :checkpyversion "%%x" "py2v" "py2path" "py3v" "py3path" ) -for /f "USEBACKQ tokens=*" %%x in (`!syspath!where.exe py 2^> nul`) do ( call :checkpyversion "%%x" "py2v" "py2path" "py3v" "py3path" ) +for /f "USEBACKQ tokens=*" %%x in (`!syspath!where.exe py 2^> nul`) do ( call :checkpylauncher "%%x" "py2v" "py2path" "py3v" "py3path" ) set "targetpy=3" if /i "!use_py3!" == "FALSE" ( set "targetpy=2" @@ -164,6 +164,12 @@ if "!pypath!" == "" ( ) goto runscript +:checkpylauncher +REM Attempt to check the latest python 2 and 3 versions via the py launcher +for /f "USEBACKQ tokens=*" %%x in (`%~1 -2 -c "import sys; print(sys.executable)" 2^> nul`) do ( call :checkpyversion "%%x" "%~2" "%~3" "%~4" "%~5" ) +for /f "USEBACKQ tokens=*" %%x in (`%~1 -3 -c "import sys; print(sys.executable)" 2^> nul`) do ( call :checkpyversion "%%x" "%~2" "%~3" "%~4" "%~5" ) +goto :EOF + :checkpyversion set "version="&for /f "tokens=2* USEBACKQ delims= " %%a in (`"%~1" -V 2^>^&1`) do ( REM Ensure we have a version number