2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-24 02:40:35 +01:00
hlsdk-xash3d/waf.bat

98 lines
1.9 KiB
Batchfile
Raw Normal View History

2019-06-11 14:04:19 +02:00
@echo off
rem try fix py2 build
2023-04-17 02:59:56 +02:00
chcp 65001
2019-06-11 14:04:19 +02:00
set PYTHONIOENCODING=UTF-8
rem from issue #964
Setlocal EnableDelayedExpansion
rem Check Windows Version
2023-04-17 02:59:56 +02:00
set TOKEN=tokens=2*
2019-06-11 14:04:19 +02:00
ver | findstr /i "5\.0\." > nul
if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3*
ver | findstr /i "5\.1\." > nul
if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3*
ver | findstr /i "5\.2\." > nul
if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3*
rem Start calculating PYTHON and PYTHON_DIR
set PYTHON=
set PYTHON_DIR=
Setlocal EnableDelayedExpansion
set PYTHON_DIR_OK=FALSE
set REGPATH=
for %%i in (3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7) do (
2019-06-11 14:04:19 +02:00
for %%j in (HKCU HKLM) do (
for %%k in (SOFTWARE\Wow6432Node SOFTWARE) do (
for %%l in (Python\PythonCore IronPython) do (
set REG_PYTHON_EXE=python.exe
if "%%l"=="IronPython" (
set REG_PYTHON_EXE=ipy.exe
)
@echo on
set REGPATH=%%j\%%k\%%l\%%i\InstallPath
rem @echo Regpath !REGPATH!
REG QUERY "!REGPATH!" /ve 1>nul 2>nul
if !ERRORLEVEL! equ 0 (
for /F "%TOKEN% delims= " %%A IN ('REG QUERY "!REGPATH!" /ve') do @set REG_PYTHON_DIR=%%B
if exist !REG_PYTHON_DIR! (
IF NOT "!REG_PYTHON_DIR:~-1!"=="\" SET REG_PYTHON_DIR=!REG_PYTHON_DIR!\
set REG_PYTHON=!REG_PYTHON_DIR!!REG_PYTHON_EXE!
rem set PYTHON_DIR_OK=TRUE
if "!PYTHON_DIR_OK!"=="FALSE" (
set PYTHON_DIR=!REG_PYTHON_DIR!
set PYTHON=!REG_PYTHON!
set PYTHON_DIR_OK=TRUE
)
rem set PYTHON_DIR_OK=FALSE
rem @echo Find !REG_PYTHON!
rem goto finished
)
)
echo off
)
rem for l
)
rem for k
)
rem for j
)
rem for i
:finished
Endlocal & SET PYTHON_DIR=%PYTHON_DIR% & SET PYTHON=%PYTHON%
if "%PYTHON_DIR%" == "" (
rem @echo No Python dir
set PYTHON=python
goto running
)
rem @echo %PYTHON_DIR%
if "%PYTHON%" == "" (
rem @echo No Python
2023-04-17 02:59:56 +02:00
set PYTHON=py
2019-06-11 14:04:19 +02:00
goto running
)
:running
@echo Using %PYTHON%
"%PYTHON%" -x "%~dp0waf" %*
Endlocal
exit /b %ERRORLEVEL%