forked from xenia-project/xenia
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xb.bat
69 lines (60 loc) · 1.89 KB
/
xb.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@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 (
ECHO.
ECHO Python 3.4+ must be installed and on PATH:
ECHO https://www.python.org/
GOTO :exit_error
)
REM ============================================================================
REM Trampoline into xenia-build
REM ============================================================================
%PYTHON_EXE% xenia-build %*
EXIT /b %ERRORLEVEL%
REM ============================================================================
REM Utilities
REM ============================================================================
:check_python
SETLOCAL
SET FOUND_PYTHON_EXE=""
1>NUL 2>NUL CMD /c where python3
IF NOT ERRORLEVEL 1 (
SET FOUND_PYTHON_EXE=python3
)
IF %FOUND_PYTHON_EXE% EQU "" (
IF EXIST c:\\python34\\python.exe SET FOUND_PYTHON_EXE=C:\\python34\\python.exe
)
IF %FOUND_PYTHON_EXE% EQU "" (
IF EXIST c:\\python35\\python.exe SET FOUND_PYTHON_EXE=C:\\python35\\python.exe
)
IF %FOUND_PYTHON_EXE% EQU "" (
IF EXIST c:\\python36\\python.exe SET FOUND_PYTHON_EXE=C:\\python36\\python.exe
)
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 ERROR: no Python executable found on PATH.
ECHO Make sure you can run 'python' or 'python3' in a Command Prompt.
ENDLOCAL & SET _RESULT=1
GOTO :eof
)
CMD /C %FOUND_PYTHON_EXE% -c "import sys; sys.exit(1 if not sys.version_info[:2] >= (3, 4) else 0)"
IF %ERRORLEVEL% NEQ 0 (
ECHO ERROR: Python version mismatch - not 3.4+
ENDLOCAL & SET _RESULT=1
GOTO :eof
)
ENDLOCAL & (
SET _RESULT=0
SET PYTHON_EXE=%FOUND_PYTHON_EXE%
)
GOTO :eof