okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge branch 'f-021-iE' into f-021-int3616148bb

main
2.1 KiB52 linesraw
1@echo off
2rem Strata Terminal launcher for Windows (cmd.exe, double-click, PATH).
3rem It finds a Python in a fixed order and hands over to strata.py. It installs nothing and downloads nothing.
4rem   1. %STRATA_PYTHON%                       an explicit override, always wins
5rem   2. <root>\python\python.exe              the private runtime shipped in the terminal archive
6rem   3. <root>\.venv\Scripts\python.exe       a source checkout set up by SETUP.bat
7rem   4. py -3 / python on PATH, 3.10 or newer a developer convenience, never a requirement
8setlocal
9rem UTF-8 text in Python, not the Windows code page: folders with Cyrillic or other letters stay intact (#3202)
10set "PYTHONUTF8=1"
11set "HERE=%~dp0"
12for %%I in ("%HERE%..") do set "ROOT=%%~fI"
13if exist "%HERE%strata.py" set "ROOT=%HERE%"
14if not exist "%ROOT%\strata.py" goto incomplete
15
16set "PY="
17if defined STRATA_PYTHON goto envpy
18if exist "%ROOT%\python\python.exe" goto bundled
19if exist "%ROOT%\.venv\Scripts\python.exe" set "PY="%ROOT%\.venv\Scripts\python.exe"" & goto run
20py -3 -c "import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)" >nul 2>nul
21if not errorlevel 1 set "PY=py -3" & goto run
22python -c "import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)" >nul 2>nul
23if not errorlevel 1 set "PY=python" & goto run
24echo strata: no usable Python found. 1>&2
25echo.       This archive carries its own runtime in python\: it is missing from this install. Reinstall the archive, 1>&2
26echo.       or set STRATA_PYTHON to a Python 3.10 or newer. 1>&2
27exit /b 5
28
29:envpy
30if not exist "%STRATA_PYTHON%" goto badenv
31set "PY="%STRATA_PYTHON%""
32goto run
33
34:bundled
35rem the private runtime: nothing from the user's site-packages or from PYTHONHOME/PYTHONPATH may leak in
36set "PYTHONNOUSERSITE=1"
37set "PYTHONHOME="
38set "PYTHONPATH="
39set "PY="%ROOT%\python\python.exe""
40goto run
41
42:run
43%PY% "%ROOT%\strata.py" %*
44exit /b %errorlevel%
45
46:badenv
47echo strata: STRATA_PYTHON=%STRATA_PYTHON% does not exist 1>&2
48exit /b 5
49
50:incomplete
51echo strata: cannot find strata.py next to "%HERE%" or its parent; the installation looks incomplete 1>&2
52exit /b 5