This commit is contained in:
onysd 2026-07-28 05:43:14 +03:00
parent 155a2435ce
commit c8eae6323f
2 changed files with 19 additions and 4 deletions

View file

@ -22,6 +22,10 @@ if errorlevel 1 (
)
rem --- Python -------------------------------------------------------------
rem Just checking "where" isn't enough: on Windows, python.exe / python3.exe
rem can resolve to the Microsoft Store app-execution-alias stub, which sits
rem on PATH but fails as soon as it's actually run instead of launching real
rem Python. Confirm each candidate's --version actually succeeds too.
set "PYTHON="
where py >nul 2>&1
if not errorlevel 1 (
@ -30,8 +34,11 @@ if not errorlevel 1 (
)
if not defined PYTHON (
where python >nul 2>&1
if not errorlevel 1 (
python --version >nul 2>&1
if not errorlevel 1 set "PYTHON=python"
)
)
if not defined PYTHON (
echo [WARN] Python 3 is not installed ^(needed to run the server-panel TUI^)

View file

@ -24,12 +24,20 @@ else
fi
# --- Python ---------------------------------------------------------------
# Just checking `command -v` isn't enough: on Windows, `python3` (and
# sometimes `python`) can resolve to the Microsoft Store app-execution-alias
# stub, which exists on PATH but fails as soon as it's actually run instead
# of launching real Python. Validate the version output too.
PYTHON=""
PYTHON_VERSION=""
for cand in python3 python; do
if command -v "$cand" >/dev/null 2>&1; then
if VER_OUT="$("$cand" --version 2>&1)" && [[ "$VER_OUT" == Python\ 3* ]]; then
PYTHON="$cand"
PYTHON_VERSION="$VER_OUT"
break
fi
fi
done
if [[ -z "$PYTHON" ]]; then
@ -37,7 +45,7 @@ if [[ -z "$PYTHON" ]]; then
echo " Install it from: https://www.python.org/downloads/"
PROBLEMS=1
else
ok "Python found: $("$PYTHON" --version 2>&1) (${PYTHON})"
ok "Python found: ${PYTHON_VERSION} (${PYTHON})"
fi
# --- Python dependencies ----------------------------------------------------