activate.bat 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. :: Set env vars that tell distutils to use the compiler that we put on path
  2. SET DISTUTILS_USE_SDK=1
  3. SET MSSdk=1
  4. SET "VS_VERSION=16.0"
  5. SET "VS_MAJOR=16"
  6. SET "VS_YEAR=2019"
  7. set "MSYS2_ARG_CONV_EXCL=/AI;/AL;/OUT;/out"
  8. set "MSYS2_ENV_CONV_EXCL=CL"
  9. :: For Python 3.5+, ensure that we link with the dynamic runtime. See
  10. :: http://stevedower.id.au/blog/building-for-python-3-5-part-two/ for more info
  11. set "PY_VCRUNTIME_REDIST=%PREFIX%\\bin\\vcruntime140.dll"
  12. for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [16^,17^) -property installationPath`) do (
  13. if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
  14. set "VSINSTALLDIR=%%i\"
  15. goto :vswhere
  16. )
  17. )
  18. :vswhere
  19. :: Shorten PATH to avoid the `input line too long` error.
  20. SET MyPath=%PATH%
  21. setlocal EnableDelayedExpansion
  22. SET TempPath="%MyPath:;=";"%"
  23. SET var=
  24. FOR %%a IN (%TempPath%) DO (
  25. IF EXIST %%~sa (
  26. SET "var=!var!;%%~sa"
  27. )
  28. )
  29. set "TempPath=!var:~1!"
  30. endlocal & set "PATH=%TempPath%"
  31. :: Shorten current directory too
  32. FOR %%A IN (.) DO CD "%%~sA"
  33. :: other things added by install_activate.bat at package build time