df
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
nose
2025-12-24 04:41:30 -08:00
parent 29b8341f72
commit 5dc4a5ad67
2 changed files with 22 additions and 13 deletions

View File

@@ -316,6 +316,15 @@ PY
if "$VENV_PY" -c 'import importlib; importlib.import_module("CLI")' >/dev/null 2>&1; then if "$VENV_PY" -c 'import importlib; importlib.import_module("CLI")' >/dev/null 2>&1; then
echo "OK: top-level 'CLI' is now importable (after .pth)." >&2 echo "OK: top-level 'CLI' is now importable (after .pth)." >&2
# Also verify we can run the packaged entrypoint using module form. If this fails
# it suggests site-packages/.pth wasn't processed reliably by the interpreter.
if "$VENV_PY" -m medeia_macina.cli_entry --help >/dev/null 2>&1; then
echo "OK: 'python -m medeia_macina.cli_entry' runs in the venv." >&2
else
echo "ERROR: 'python -m medeia_macina.cli_entry' failed in the venv despite .pth being written; aborting." >&2
exit 6
fi
else else
echo "ERROR: top-level 'CLI' still not importable after writing .pth ($pth_file)." >&2 echo "ERROR: top-level 'CLI' still not importable after writing .pth ($pth_file)." >&2
exit 6 exit 6
@@ -528,12 +537,7 @@ PY
echo "MM_DEBUG: end diagnostics" >&2 echo "MM_DEBUG: end diagnostics" >&2
fi fi
# Packaged console script in the venv if available # Prefer venv's python3, then venv's python (module invocation - more deterministic)
if [ -x "$VENV/bin/mm" ]; then
exec "$VENV/bin/mm" "$@"
fi
# Prefer venv's python3, then venv's python
if [ -x "$VENV/bin/python3" ]; then if [ -x "$VENV/bin/python3" ]; then
exec "$VENV/bin/python3" -m medeia_macina.cli_entry "$@" exec "$VENV/bin/python3" -m medeia_macina.cli_entry "$@"
fi fi
@@ -541,6 +545,11 @@ if [ -x "$VENV/bin/python" ]; then
exec "$VENV/bin/python" -m medeia_macina.cli_entry "$@" exec "$VENV/bin/python" -m medeia_macina.cli_entry "$@"
fi fi
# Fallback: packaged console script in the venv (older pip-generated wrapper)
if [ -x "$VENV/bin/mm" ]; then
exec "$VENV/bin/mm" "$@"
fi
# Fallback to system python3, then system python (only if it's Python 3) # Fallback to system python3, then system python (only if it's Python 3)
if command -v python3 >/dev/null 2>&1; then if command -v python3 >/dev/null 2>&1; then
exec python3 -m medeia_macina.cli_entry "$@" exec python3 -m medeia_macina.cli_entry "$@"

View File

@@ -304,11 +304,10 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$SCRIPT_DIR" REPO="$SCRIPT_DIR"
VENV="$REPO/.venv" VENV="$REPO/.venv"
PY="$VENV/bin/python" PY="$VENV/bin/python"
CLI_SCRIPT="$REPO/CLI.py"
if [ -x "$PY" ]; then if [ -x "$PY" ]; then
exec "$PY" "$CLI_SCRIPT" "$@" exec "$PY" -m medeia_macina.cli_entry "$@"
else else
exec python "$CLI_SCRIPT" "$@" exec python -m medeia_macina.cli_entry "$@"
fi fi
""" """
try: try:
@@ -323,10 +322,10 @@ $repo = $scriptDir
$venv = Join-Path $repo '.venv' $venv = Join-Path $repo '.venv'
$py = Join-Path $venv 'Scripts\python.exe' $py = Join-Path $venv 'Scripts\python.exe'
$cli = Join-Path $repo 'CLI.py' $cli = Join-Path $repo 'CLI.py'
if (Test-Path $py) { & $py $cli @args; exit $LASTEXITCODE } if (Test-Path $py) { & $py -m medeia_macina.cli_entry @args; exit $LASTEXITCODE }
if (Test-Path $cli) { & $py $cli @args; exit $LASTEXITCODE } if (Test-Path $cli) { & python $cli @args; exit $LASTEXITCODE }
# fallback # fallback
python $cli @args python -m medeia_macina.cli_entry @args
""" """
try: try:
ps1.write_text(ps1_text, encoding="utf-8") ps1.write_text(ps1_text, encoding="utf-8")
@@ -336,9 +335,10 @@ python $cli @args
bat_text = ( bat_text = (
"@echo off\r\n" "@echo off\r\n"
"set SCRIPT_DIR=%~dp0\r\n" "set SCRIPT_DIR=%~dp0\r\n"
"if exist \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" \"%SCRIPT_DIR%\\CLI.py\" %*\r\n" "if exist \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" -m medeia_macina.cli_entry %*\r\n"
"if exist \"%SCRIPT_DIR%\\CLI.py\" python \"%SCRIPT_DIR%\\CLI.py\" %*\r\n" "if exist \"%SCRIPT_DIR%\\CLI.py\" python \"%SCRIPT_DIR%\\CLI.py\" %*\r\n"
"python -m medeia_macina.cli_entry %*\r\n" "python -m medeia_macina.cli_entry %*\r\n"
"python -m medeia_macina.cli_entry %*\r\n"
) )
try: try:
bat.write_text(bat_text, encoding="utf-8") bat.write_text(bat_text, encoding="utf-8")