diff options
author | Steve Dower <steve.dower@python.org> | 2020-11-18 17:24:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 17:24:36 (GMT) |
commit | 2156d964a12285280c533af1c96eb273c58451e6 (patch) | |
tree | 9481f5ca37da936f0759783843df58891768b66f /PCbuild/env.bat | |
parent | 07f2adedf0940b06d136208ec386d69b7d2d5b43 (diff) | |
download | cpython-2156d964a12285280c533af1c96eb273c58451e6.zip cpython-2156d964a12285280c533af1c96eb273c58451e6.tar.gz cpython-2156d964a12285280c533af1c96eb273c58451e6.tar.bz2 |
bpo-42336: Improve PCbuild batch files (GH-23275)
Diffstat (limited to 'PCbuild/env.bat')
-rw-r--r-- | PCbuild/env.bat | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/PCbuild/env.bat b/PCbuild/env.bat index 9d4c9d1..2820e30 100644 --- a/PCbuild/env.bat +++ b/PCbuild/env.bat @@ -9,8 +9,19 @@ rem 'v110', 'v120' or 'v140') to the build script. echo Build environments: x86, amd64, x86_amd64 echo. -set VSTOOLS=%VS140COMNTOOLS% -if "%VSTOOLS%"=="" set VSTOOLS=%VS120COMNTOOLS% -if "%VSTOOLS%"=="" set VSTOOLS=%VS110COMNTOOLS% -if "%VSTOOLS%"=="" set VSTOOLS=%VS100COMNTOOLS% -call "%VSTOOLS%..\..\VC\vcvarsall.bat" %* +set _ARGS=%* +if NOT DEFINED _ARGS set _ARGS=amd64 + +if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" goto :skip_vswhere +set VSTOOLS= +for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO @(set VSTOOLS=%%i\VC\Auxiliary\Build\vcvarsall.bat) +if not defined VSTOOLS goto :skip_vswhere +call "%VSTOOLS%" %_ARGS% +exit /B 0 + +:skip_vswhere +if not defined VSTOOLS set VSTOOLS=%VS140COMNTOOLS% +if not defined VSTOOLS set VSTOOLS=%VS120COMNTOOLS% +if not defined VSTOOLS set VSTOOLS=%VS110COMNTOOLS% +if not defined VSTOOLS set VSTOOLS=%VS100COMNTOOLS% +call "%VSTOOLS%..\..\VC\vcvarsall.bat" %_ARGS% |