-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_installed_or_refresh_xuunity_mcp.cmd
More file actions
62 lines (51 loc) · 1.95 KB
/
Copy pathrun_installed_or_refresh_xuunity_mcp.cmd
File metadata and controls
62 lines (51 loc) · 1.95 KB
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
@echo off
setlocal
set "SCRIPT_DIR=%~dp0"
set "XUUNITY_TARGET=%SCRIPT_DIR%run_installed_or_refresh_xuunity_mcp.py"
if not defined PYTHONUTF8 set "PYTHONUTF8=1"
set "XUUNITY_PYTHON_CMD="
if not defined PYTHON goto xuunity_try_venv
set "XUUNITY_PYTHON_OVERRIDE=%PYTHON:"=%"
if /i "%XUUNITY_PYTHON_OVERRIDE%"=="py -3" goto xuunity_override_is_py
call :xuunity_probe "%XUUNITY_PYTHON_OVERRIDE%"
if errorlevel 1 goto xuunity_override_failed
set "XUUNITY_PYTHON_CMD="%XUUNITY_PYTHON_OVERRIDE%""
goto xuunity_run
:xuunity_override_is_py
call :xuunity_probe py -3
if errorlevel 1 goto xuunity_override_failed
set "XUUNITY_PYTHON_CMD=py -3"
goto xuunity_run
:xuunity_override_failed
echo PYTHON is set to "%XUUNITY_PYTHON_OVERRIDE%" but it is not a working Python 3.10+ interpreter. 1>&2
exit /b 9009
:xuunity_try_venv
if not exist "%SCRIPT_DIR%.venv\Scripts\python.exe" goto xuunity_try_py
call :xuunity_probe "%SCRIPT_DIR%.venv\Scripts\python.exe"
if errorlevel 1 goto xuunity_try_py
set "XUUNITY_PYTHON_CMD="%SCRIPT_DIR%.venv\Scripts\python.exe""
goto xuunity_run
:xuunity_try_py
call :xuunity_probe py -3
if errorlevel 1 goto xuunity_try_python
set "XUUNITY_PYTHON_CMD=py -3"
goto xuunity_run
:xuunity_try_python
call :xuunity_probe python
if errorlevel 1 goto xuunity_try_python3
set "XUUNITY_PYTHON_CMD=python"
goto xuunity_run
:xuunity_try_python3
call :xuunity_probe python3
if errorlevel 1 goto xuunity_not_found
set "XUUNITY_PYTHON_CMD=python3"
goto xuunity_run
:xuunity_not_found
echo Python 3.10 or newer was not found. Install it from https://www.python.org/downloads/ and reopen the terminal, or set PYTHON to a Python 3.10+ interpreter. 1>&2
echo Note: on a fresh Windows the "python" command is often the Microsoft Store stub, which cannot run scripts and is rejected by this launcher. 1>&2
exit /b 9009
:xuunity_probe
%* -c "import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 2)" >nul 2>nul
goto :eof
:xuunity_run
%XUUNITY_PYTHON_CMD% "%XUUNITY_TARGET%" %*