Slim version detection code per LussacZheng

Info at https://github.com/corpnewt/gibMacOS/issues/20
This commit is contained in:
CorpNewt
2019-09-13 10:53:08 -05:00
committed by GitHub
parent ce6f62c388
commit dde95c93ce
2 changed files with 4 additions and 44 deletions
+2 -22
View File
@@ -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"
+2 -22
View File
@@ -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"