From dde95c93cecbb671f37c023c295a006587a35e69 Mon Sep 17 00:00:00 2001 From: CorpNewt <12772521+corpnewt@users.noreply.github.com> Date: Fri, 13 Sep 2019 10:53:08 -0500 Subject: [PATCH] Slim version detection code per LussacZheng Info at https://github.com/corpnewt/gibMacOS/issues/20 --- MakeInstall.bat | 24 ++---------------------- gibMacOS.bat | 24 ++---------------------- 2 files changed, 4 insertions(+), 44 deletions(-) diff --git a/MakeInstall.bat b/MakeInstall.bat index c05609f..7cc8901 100644 --- a/MakeInstall.bat +++ b/MakeInstall.bat @@ -116,31 +116,11 @@ if not exist "%TEMP%\pyurl.txt" ( ) echo Parsing for latest... -REM Got the file, let's parse it pushd "%TEMP%" -set "release=" -for /F "tokens=*" %%x in (pyurl.txt) do ( - set "t=%%x" - if /i not "%%x" == "" ( - if /i not "!t:Latest Python 3=!"=="!t!" ( - REM echo !t! - set "release=!t!" - ) - ) -) +:: Version detection code slimmed by LussacZheng (https://github.com/corpnewt/gibMacOS/issues/20) +for /f "tokens=9 delims=< " %%x in ('findstr /i /c:"Latest Python 3 Release" pyurl.txt') do ( set "release=%%x" ) popd -REM Let's replace the " with ' and split the string by spaces -REM to get the actual version number -set "release=!release:"='!" -for /F "tokens=8* delims= " %%x in ("!release!") do ( - set "release=%%x" -) -REM Once more - split at the < and get the first -for /F "tokens=1* delims=<" %%x in ("!release!") do ( - set "release=%%x" -) - echo Found Python !release! - Downloading... REM Let's delete our txt file now - we no longer need it del "%TEMP%\pyurl.txt" diff --git a/gibMacOS.bat b/gibMacOS.bat index cabe321..811ce95 100644 --- a/gibMacOS.bat +++ b/gibMacOS.bat @@ -90,31 +90,11 @@ if not exist "%TEMP%\pyurl.txt" ( ) echo Parsing for latest... -REM Got the file, let's parse it pushd "%TEMP%" -set "release=" -for /F "tokens=*" %%x in (pyurl.txt) do ( - set "t=%%x" - if /i not "%%x" == "" ( - if /i not "!t:Latest Python 3=!"=="!t!" ( - REM echo !t! - set "release=!t!" - ) - ) -) +:: Version detection code slimmed by LussacZheng (https://github.com/corpnewt/gibMacOS/issues/20) +for /f "tokens=9 delims=< " %%x in ('findstr /i /c:"Latest Python 3 Release" pyurl.txt') do ( set "release=%%x" ) popd -REM Let's replace the " with ' and split the string by spaces -REM to get the actual version number -set "release=!release:"='!" -for /F "tokens=8* delims= " %%x in ("!release!") do ( - set "release=%%x" -) -REM Once more - split at the < and get the first -for /F "tokens=1* delims=<" %%x in ("!release!") do ( - set "release=%%x" -) - echo Found Python !release! - Downloading... REM Let's delete our txt file now - we no longer need it del "%TEMP%\pyurl.txt"