bootstrap/setup: make global 'mm' wrapper prefer venv/python3 and fall back to python; include informative error when no Python found

This commit is contained in:
nose
2025-12-24 03:03:36 -08:00
parent 64aba67a31
commit 4cfe401eb3
2 changed files with 17 additions and 7 deletions

View File

@@ -363,13 +363,18 @@ python $cli @args
sh_text = (
"#!/usr/bin/env bash\n"
f"REPO=\"{repo}\"\n"
"VENV=\"$REPO/.venv\"\n"
f"VENV=\"{repo}/.venv\"\n"
"if [ -x \"$VENV/bin/mm\" ]; then\n"
" exec \"$VENV/bin/mm\" \"$@\"\n"
"elif [ -x \"$VENV/bin/python\" ]; then\n"
" exec \"$VENV/bin/python\" -m medeia_entry \"$@\"\n"
" exec \"$VENV/bin/python\" -m medeia_macina.cli_entry \"$@\"\n"
"elif command -v python3 >/dev/null 2>&1; then\n"
" exec python3 -m medeia_macina.cli_entry \"$@\"\n"
"elif command -v python >/dev/null 2>&1; then\n"
" exec python -m medeia_macina.cli_entry \"$@\"\n"
"else\n"
" exec python -m medeia_entry \"$@\"\n"
" echo 'Error: no Python interpreter (python3 or python) found in PATH. Please install Python 3 or use the venv.' >&2\n"
" exit 127\n"
"fi\n"
)
if mm_sh.exists():