2013-10-18 06:35:54 +00:00
|
|
|
@ECHO OFF
|
2015-05-03 04:46:42 +00:00
|
|
|
REM Copyright 2015 Ben Vanik. All Rights Reserved.
|
2013-10-18 06:35:54 +00:00
|
|
|
|
2019-08-23 15:39:03 +00:00
|
|
|
SET "DIR=%~dp0"
|
2013-10-18 06:35:54 +00:00
|
|
|
|
2015-05-03 04:46:42 +00:00
|
|
|
REM ============================================================================
|
|
|
|
REM Environment Validation
|
|
|
|
REM ============================================================================
|
|
|
|
|
|
|
|
CALL :check_python
|
|
|
|
IF %_RESULT% NEQ 0 (
|
2015-11-25 23:22:53 +00:00
|
|
|
ECHO.
|
2020-03-30 22:37:32 +00:00
|
|
|
ECHO Python 3.6+ must be installed and on PATH:
|
2017-09-21 21:42:57 +00:00
|
|
|
ECHO https://www.python.org/
|
2019-08-17 11:12:05 +00:00
|
|
|
GOTO :eof
|
2015-05-03 04:46:42 +00:00
|
|
|
)
|
|
|
|
|
2015-06-23 04:49:25 +00:00
|
|
|
|
2015-05-03 04:46:42 +00:00
|
|
|
REM ============================================================================
|
2015-08-01 06:48:24 +00:00
|
|
|
REM Trampoline into xenia-build
|
2015-05-03 04:46:42 +00:00
|
|
|
REM ============================================================================
|
|
|
|
|
2019-08-23 15:39:03 +00:00
|
|
|
"%PYTHON_EXE%" "%DIR%\xenia-build" %*
|
2015-08-01 06:48:24 +00:00
|
|
|
EXIT /b %ERRORLEVEL%
|
2015-05-03 04:46:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
REM ============================================================================
|
|
|
|
REM Utilities
|
|
|
|
REM ============================================================================
|
|
|
|
|
|
|
|
:check_python
|
2019-08-17 11:12:05 +00:00
|
|
|
SETLOCAL ENABLEDELAYEDEXPANSION
|
|
|
|
|
|
|
|
SET FOUND_PATH=""
|
|
|
|
|
2019-08-23 15:39:03 +00:00
|
|
|
SET "CANDIDATE_PATHS[0]=C:\python37\python.exe"
|
|
|
|
SET "CANDIDATE_PATHS[1]=C:\python36\python.exe"
|
2020-03-30 22:37:32 +00:00
|
|
|
SET OUTPUT_INDEX=2
|
2019-08-17 11:12:05 +00:00
|
|
|
|
2019-08-23 15:39:03 +00:00
|
|
|
FOR /F "usebackq delims=" %%L IN (`2^>NUL where python3`) DO (
|
|
|
|
IF %%~zL NEQ 0 (
|
|
|
|
SET "CANDIDATE_PATHS[!OUTPUT_INDEX!]=%%L"
|
|
|
|
SET /A OUTPUT_INDEX+=1
|
|
|
|
)
|
2017-09-21 21:42:57 +00:00
|
|
|
)
|
2019-08-23 15:39:03 +00:00
|
|
|
FOR /F "usebackq delims=" %%L IN (`2^>NUL where python`) DO (
|
|
|
|
IF %%~zL NEQ 0 (
|
|
|
|
SET "CANDIDATE_PATHS[!OUTPUT_INDEX!]=%%L"
|
|
|
|
SET /A OUTPUT_INDEX+=1
|
|
|
|
)
|
2016-09-28 23:30:45 +00:00
|
|
|
)
|
2019-08-17 11:12:05 +00:00
|
|
|
|
|
|
|
SET CANDIDATE_INDEX=0
|
|
|
|
:check_candidate_loop
|
|
|
|
IF NOT DEFINED CANDIDATE_PATHS[%CANDIDATE_INDEX%] (
|
|
|
|
GOTO :found_python
|
2019-08-17 11:11:36 +00:00
|
|
|
)
|
2019-08-17 11:12:05 +00:00
|
|
|
CALL SET CANDIDATE_PATH=%%CANDIDATE_PATHS[%CANDIDATE_INDEX%]%%
|
2019-08-23 15:39:03 +00:00
|
|
|
IF NOT EXIST "%CANDIDATE_PATH%" (
|
2019-08-18 14:33:59 +00:00
|
|
|
SET /A CANDIDATE_INDEX+=1
|
|
|
|
GOTO :check_candidate_loop
|
|
|
|
)
|
2019-08-23 15:39:03 +00:00
|
|
|
SET "FOUND_PATH=%CANDIDATE_PATH%"
|
2019-08-17 11:12:05 +00:00
|
|
|
|
|
|
|
:found_python
|
2019-08-23 15:39:03 +00:00
|
|
|
IF "%FOUND_PATH%"=="" (
|
2015-11-25 23:22:53 +00:00
|
|
|
ECHO ERROR: no Python executable found on PATH.
|
2017-09-21 21:42:57 +00:00
|
|
|
ECHO Make sure you can run 'python' or 'python3' in a Command Prompt.
|
2015-05-03 04:46:42 +00:00
|
|
|
ENDLOCAL & SET _RESULT=1
|
|
|
|
GOTO :eof
|
|
|
|
)
|
2019-08-17 11:12:05 +00:00
|
|
|
|
2020-03-30 22:37:32 +00:00
|
|
|
CMD /C ""%FOUND_PATH%" -c "import sys; sys.exit(1 if not sys.version_info[:2] ^>= (3, 6) else 0)"
|
2015-05-03 04:46:42 +00:00
|
|
|
IF %ERRORLEVEL% NEQ 0 (
|
2020-03-30 22:37:32 +00:00
|
|
|
ECHO ERROR: Python version mismatch, not at least 3.6.
|
2019-08-23 15:39:03 +00:00
|
|
|
ECHO Found Python executable was "%FOUND_PATH%".
|
2015-05-03 04:46:42 +00:00
|
|
|
ENDLOCAL & SET _RESULT=1
|
|
|
|
GOTO :eof
|
|
|
|
)
|
2019-08-17 11:12:05 +00:00
|
|
|
|
2015-11-25 23:22:53 +00:00
|
|
|
ENDLOCAL & (
|
|
|
|
SET _RESULT=0
|
2019-08-23 15:39:03 +00:00
|
|
|
SET "PYTHON_EXE=%FOUND_PATH%"
|
2015-11-25 23:22:53 +00:00
|
|
|
)
|
2015-05-03 04:46:42 +00:00
|
|
|
GOTO :eof
|