servo/mach.bat
TheGoddessInari e1eb36050e Default mach.bat to using py -2.
Servo already assumes the user has Python, this is the primary
way to make sure that Python 2 is preferred, and you should
get a sensible error message if you have python 3 but not 2.

But first, check that py.exe exists because if a system has only
Python 2.x only, it won't have it. If it doesn't, then try python.exe.
2019-04-01 11:15:22 -04:00

44 lines
1,009 B
Batchfile

@echo off
pushd .
IF EXIST "%ProgramFiles(x86)%" (
set "ProgramFiles32=%ProgramFiles(x86)%"
) ELSE (
set "ProgramFiles32=%ProgramFiles%"
)
set VC14VARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat
IF EXIST "%VC14VARS%" (
set "VS_VCVARS=%VC14VARS%"
) ELSE (
for %%e in (Enterprise Professional Community BuildTools) do (
IF EXIST "%ProgramFiles32%\Microsoft Visual Studio\2017\%%e\VC\Auxiliary\Build\vcvarsall.bat" (
set "VS_VCVARS=%ProgramFiles32%\Microsoft Visual Studio\2017\%%e\VC\Auxiliary\Build\vcvarsall.bat"
)
)
)
IF EXIST "%VS_VCVARS%" (
IF NOT DEFINED Platform (
IF EXIST "%ProgramFiles(x86)%" (
call "%VS_VCVARS%" x64
) ELSE (
ECHO 32-bit Windows is currently unsupported.
EXIT /B 1
)
)
) ELSE (
ECHO Visual Studio 2015 or 2017 is not installed.
ECHO Download and install Visual Studio 2015 or 2017 from https://www.visualstudio.com/
EXIT /B 1
)
popd
where /Q py.exe
IF %ERRORLEVEL% NEQ 0 (
python mach %*
) ELSE (
py -2 mach %*
)