df
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled
This commit is contained in:
@@ -316,6 +316,15 @@ PY
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
echo "ERROR: top-level 'CLI' still not importable after writing .pth ($pth_file)." >&2
|
||||
exit 6
|
||||
@@ -528,12 +537,7 @@ PY
|
||||
echo "MM_DEBUG: end diagnostics" >&2
|
||||
fi
|
||||
|
||||
# Packaged console script in the venv if available
|
||||
if [ -x "$VENV/bin/mm" ]; then
|
||||
exec "$VENV/bin/mm" "$@"
|
||||
fi
|
||||
|
||||
# Prefer venv's python3, then venv's python
|
||||
# Prefer venv's python3, then venv's python (module invocation - more deterministic)
|
||||
if [ -x "$VENV/bin/python3" ]; then
|
||||
exec "$VENV/bin/python3" -m medeia_macina.cli_entry "$@"
|
||||
fi
|
||||
@@ -541,6 +545,11 @@ if [ -x "$VENV/bin/python" ]; then
|
||||
exec "$VENV/bin/python" -m medeia_macina.cli_entry "$@"
|
||||
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)
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
exec python3 -m medeia_macina.cli_entry "$@"
|
||||
|
||||
@@ -304,11 +304,10 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO="$SCRIPT_DIR"
|
||||
VENV="$REPO/.venv"
|
||||
PY="$VENV/bin/python"
|
||||
CLI_SCRIPT="$REPO/CLI.py"
|
||||
if [ -x "$PY" ]; then
|
||||
exec "$PY" "$CLI_SCRIPT" "$@"
|
||||
exec "$PY" -m medeia_macina.cli_entry "$@"
|
||||
else
|
||||
exec python "$CLI_SCRIPT" "$@"
|
||||
exec python -m medeia_macina.cli_entry "$@"
|
||||
fi
|
||||
"""
|
||||
try:
|
||||
@@ -323,10 +322,10 @@ $repo = $scriptDir
|
||||
$venv = Join-Path $repo '.venv'
|
||||
$py = Join-Path $venv 'Scripts\python.exe'
|
||||
$cli = Join-Path $repo 'CLI.py'
|
||||
if (Test-Path $py) { & $py $cli @args; exit $LASTEXITCODE }
|
||||
if (Test-Path $cli) { & $py $cli @args; exit $LASTEXITCODE }
|
||||
if (Test-Path $py) { & $py -m medeia_macina.cli_entry @args; exit $LASTEXITCODE }
|
||||
if (Test-Path $cli) { & python $cli @args; exit $LASTEXITCODE }
|
||||
# fallback
|
||||
python $cli @args
|
||||
python -m medeia_macina.cli_entry @args
|
||||
"""
|
||||
try:
|
||||
ps1.write_text(ps1_text, encoding="utf-8")
|
||||
@@ -336,9 +335,10 @@ python $cli @args
|
||||
bat_text = (
|
||||
"@echo off\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"
|
||||
"python -m medeia_macina.cli_entry %*\r\n"
|
||||
"python -m medeia_macina.cli_entry %*\r\n"
|
||||
)
|
||||
try:
|
||||
bat.write_text(bat_text, encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user