[xb] Remove useless version check
The version is already checked in xenia-build. Add an actually useful 64-bit check.
This commit is contained in:
@@ -12,7 +12,7 @@ drivers.
|
|||||||
* [Visual Studio 2022](https://www.visualstudio.com/downloads/)
|
* [Visual Studio 2022](https://www.visualstudio.com/downloads/)
|
||||||
* CMake 3.10+ (or C++ CMake tools for Windows)
|
* CMake 3.10+ (or C++ CMake tools for Windows)
|
||||||
* Windows 11 SDK version 10.0.22000.0 (for Visual Studio 2022, this or any newer version)
|
* Windows 11 SDK version 10.0.22000.0 (for Visual Studio 2022, this or any newer version)
|
||||||
* [Python 3.9+](https://www.python.org/downloads/)
|
* [Python 3.9+ 64-bit](https://www.python.org/downloads/)
|
||||||
* Ensure Python is in PATH.
|
* Ensure Python is in PATH.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
24
xb.bat
24
xb.bat
@@ -7,12 +7,10 @@ REM ============================================================================
|
|||||||
REM Environment Validation
|
REM Environment Validation
|
||||||
REM ============================================================================
|
REM ============================================================================
|
||||||
|
|
||||||
SET "PYTHON_MINIMUM_VERSION[0]=3"
|
|
||||||
SET "PYTHON_MINIMUM_VERSION[1]=9"
|
|
||||||
CALL :check_python
|
CALL :check_python
|
||||||
IF %_RESULT% NEQ 0 (
|
IF %_RESULT% NEQ 0 (
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO Python %PYTHON_MINIMUM_VERSION[0]%.%PYTHON_MINIMUM_VERSION[1]%+ must be installed and on PATH:
|
ECHO Python 3.9+ must be installed and on PATH:
|
||||||
ECHO https://www.python.org/
|
ECHO https://www.python.org/
|
||||||
GOTO :eof
|
GOTO :eof
|
||||||
)
|
)
|
||||||
@@ -35,22 +33,16 @@ SETLOCAL ENABLEDELAYEDEXPANSION
|
|||||||
|
|
||||||
SET FOUND_PATH=""
|
SET FOUND_PATH=""
|
||||||
|
|
||||||
SET "CANDIDATE_PATHS[0]=C:\python314\python.exe"
|
|
||||||
SET "CANDIDATE_PATHS[1]=C:\python313\python.exe"
|
|
||||||
SET "CANDIDATE_PATHS[2]=C:\python312\python.exe"
|
|
||||||
SET "CANDIDATE_PATHS[3]=C:\python311\python.exe"
|
|
||||||
SET "CANDIDATE_PATHS[4]=C:\python310\python.exe"
|
|
||||||
SET "CANDIDATE_PATHS[5]=C:\python%PYTHON_MINIMUM_VERSION[0]%%PYTHON_MINIMUM_VERSION[1]%\python.exe"
|
|
||||||
SET "CANDIDATE_PATHS[6]=%WINDIR%\py.exe"
|
SET "CANDIDATE_PATHS[6]=%WINDIR%\py.exe"
|
||||||
SET OUTPUT_INDEX=7
|
SET OUTPUT_INDEX=1
|
||||||
|
|
||||||
FOR /F "usebackq delims=" %%L IN (`2^>NUL where python3`) DO (
|
FOR /F "usebackq delims=" %%L IN (`2^>NUL where python`) DO (
|
||||||
IF %%~zL NEQ 0 (
|
IF %%~zL NEQ 0 (
|
||||||
SET "CANDIDATE_PATHS[!OUTPUT_INDEX!]=%%L"
|
SET "CANDIDATE_PATHS[!OUTPUT_INDEX!]=%%L"
|
||||||
SET /A OUTPUT_INDEX+=1
|
SET /A OUTPUT_INDEX+=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
FOR /F "usebackq delims=" %%L IN (`2^>NUL where python`) DO (
|
FOR /F "usebackq delims=" %%L IN (`2^>NUL where python3`) DO (
|
||||||
IF %%~zL NEQ 0 (
|
IF %%~zL NEQ 0 (
|
||||||
SET "CANDIDATE_PATHS[!OUTPUT_INDEX!]=%%L"
|
SET "CANDIDATE_PATHS[!OUTPUT_INDEX!]=%%L"
|
||||||
SET /A OUTPUT_INDEX+=1
|
SET /A OUTPUT_INDEX+=1
|
||||||
@@ -77,14 +69,6 @@ IF "%FOUND_PATH%"=="" (
|
|||||||
GOTO :eof
|
GOTO :eof
|
||||||
)
|
)
|
||||||
|
|
||||||
CMD /C ""%FOUND_PATH%" -c "import sys; sys.exit(1 if not sys.version_info[:2] ^>= (%PYTHON_MINIMUM_VERSION[0]%, %PYTHON_MINIMUM_VERSION[1]%) else 0)"
|
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
|
||||||
ECHO ERROR: Python version mismatch, not at least %PYTHON_MINIMUM_VERSION[0]%.%PYTHON_MINIMUM_VERSION[1]%.
|
|
||||||
ECHO Found Python executable was "%FOUND_PATH%".
|
|
||||||
ENDLOCAL & SET _RESULT=1
|
|
||||||
GOTO :eof
|
|
||||||
)
|
|
||||||
|
|
||||||
ENDLOCAL & (
|
ENDLOCAL & (
|
||||||
SET _RESULT=0
|
SET _RESULT=0
|
||||||
SET "PYTHON_EXE=%FOUND_PATH%"
|
SET "PYTHON_EXE=%FOUND_PATH%"
|
||||||
|
|||||||
20
xb.ps1
20
xb.ps1
@@ -1,27 +1,15 @@
|
|||||||
function Write-FatalError($message) {
|
$pythonExecutables = "python", "python3", "py"
|
||||||
[Console]::ForegroundColor = 'red'
|
|
||||||
[Console]::Error.WriteLine($message)
|
|
||||||
[Console]::ResetColor()
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
$pythonExecutables = 'python', 'python3'
|
|
||||||
foreach ($pythonExecutable in $pythonExecutables) {
|
foreach ($pythonExecutable in $pythonExecutables) {
|
||||||
if (!$pythonPath) {
|
if (!$pythonPath) {
|
||||||
$pythonPath = powershell -NoLogo -NonInteractive "(Get-Command -ErrorAction SilentlyContinue $pythonexecutable).Definition" # Hack to not give command suggestion
|
$pythonPath = powershell -NoLogo -NonInteractive "(Get-Command -ErrorAction SilentlyContinue $pythonexecutable).Definition" # Hack to not give command suggestion
|
||||||
} else {
|
if ($pythonPath) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# Neither found, error and exit
|
# Neither found, error and exit
|
||||||
$pythonMinimumVer = 3,9
|
|
||||||
if (!$pythonPath) {
|
if (!$pythonPath) {
|
||||||
Write-FatalError "ERROR: Python $($pythonMinimumVer[0]).$($pythonMinimumVer[1])+ must be installed and on PATH:`nhttps://www.python.org/"
|
Throw "ERROR: Python 3.9+ 64-bit must be installed and on PATH:`nhttps://www.python.org/"
|
||||||
}
|
|
||||||
|
|
||||||
& $pythonPath -c "import sys; sys.exit(1 if not sys.version_info[:2] >= ($($pythonMinimumVer[0]), $($pythonMinimumVer[1])) else 0)"
|
|
||||||
if ($LASTEXITCODE -gt 0) {
|
|
||||||
Write-FatalError "ERROR: Python version mismatch, not at least $($pythonMinimumVer[0]).$($pythonMinimumVer[1]).`nFound Python executable was `"$($pythonPath)`"."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
& $pythonPath "$($PSScriptRoot)/xenia-build" $args
|
& $pythonPath "$($PSScriptRoot)/xenia-build" $args
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ def main():
|
|||||||
|
|
||||||
# Check python version.
|
# Check python version.
|
||||||
python_minimum_ver = 3,9
|
python_minimum_ver = 3,9
|
||||||
if not sys.version_info[:2] >= (python_minimum_ver[0], python_minimum_ver[1]):
|
if not sys.version_info[:2] >= (python_minimum_ver[0], python_minimum_ver[1]) or not sys.maxsize > 2**32:
|
||||||
print(f"ERROR: Python {python_minimum_ver[0]}.{python_minimum_ver[1]} must be installed and on PATH")
|
print(f"ERROR: Python {python_minimum_ver[0]}.{python_minimum_ver[1]}+ 64-bit must be installed and on PATH")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Grab Visual Studio version and execute shell to set up environment.
|
# Grab Visual Studio version and execute shell to set up environment.
|
||||||
|
|||||||
Reference in New Issue
Block a user