xenia-canary/xb.bat

66 lines
1.7 KiB
Batchfile
Raw Normal View History

@ECHO OFF
REM Copyright 2015 Ben Vanik. All Rights Reserved.
SET DIR=%~dp0
REM ============================================================================
REM Environment Validation
REM ============================================================================
CALL :check_python
IF %_RESULT% NEQ 0 (
2015-11-25 23:22:53 +00:00
ECHO.
ECHO Python 2.7 must be installed and on PATH:
ECHO https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi
GOTO :exit_error
)
REM ============================================================================
2015-08-01 06:48:24 +00:00
REM Trampoline into xenia-build
REM ============================================================================
2015-11-25 23:22:53 +00:00
%PYTHON_EXE% xenia-build %*
2015-08-01 06:48:24 +00:00
EXIT /b %ERRORLEVEL%
REM ============================================================================
REM Utilities
REM ============================================================================
:check_python
SETLOCAL
2015-11-25 23:22:53 +00:00
SET FOUND_PYTHON_EXE=""
1>NUL 2>NUL CMD /c where python2
IF NOT ERRORLEVEL 1 (
ECHO FOUND PYTHON 2
SET FOUND_PYTHON_EXE=python2
)
IF %FOUND_PYTHON_EXE% EQU "" (
1>NUL 2>NUL CMD /c where python
IF NOT ERRORLEVEL 1 (
SET FOUND_PYTHON_EXE=python
)
)
IF %FOUND_PYTHON_EXE% EQU "" (
ECHO Found from fs
IF EXIST c:\python27\python.exe SET FOUND_PYTHON_EXE=C:\python27\python.exe
)
2015-11-25 23:22:53 +00:00
IF %FOUND_PYTHON_EXE% EQU "" (
ECHO ERROR: no Python executable found on PATH.
ECHO Make sure you can run 'python' or 'python2' in a Command Prompt.
ENDLOCAL & SET _RESULT=1
GOTO :eof
)
2015-11-25 23:22:53 +00:00
CMD /C %FOUND_PYTHON_EXE% -c "import sys; sys.exit(1 if not sys.version_info[:2] == (2, 7) else 0)"
IF %ERRORLEVEL% NEQ 0 (
2015-11-25 23:22:53 +00:00
ECHO ERROR: Python version mismatch - not 2.7
ENDLOCAL & SET _RESULT=1
GOTO :eof
)
2015-11-25 23:22:53 +00:00
ENDLOCAL & (
SET _RESULT=0
SET PYTHON_EXE=%FOUND_PYTHON_EXE%
)
GOTO :eof