This commit is contained in:
2026-01-01 00:54:03 -08:00
parent ff3bcb6611
commit f3c79609d8
8 changed files with 32 additions and 316 deletions

View File

@@ -332,8 +332,8 @@ if [[ "$NOINSTALL" != "true" ]]; then # If not explicitly requested, auto-selec
# Verify the installed CLI module can be imported. This helps catch packaging
# or installation problems early (e.g., missing modules or mispackaged project).
echo "Verifying installed CLI import..."
if "$VENV_PY" -c 'import importlib; importlib.import_module("medeia_macina.cli_entry")' >/dev/null 2>&1; then
echo "OK: 'medeia_macina.cli_entry' is importable in the venv."
if "$VENV_PY" -c 'import importlib; importlib.import_module("scripts.cli_entry")' >/dev/null 2>&1; then
echo "OK: 'scripts.cli_entry' is importable in the venv."
# Ensure the top-level 'CLI' module is importable (required by legacy entrypoints).
# For PEP 660 editable installs, create a small .pth in the venv site-packages
@@ -372,10 +372,10 @@ PY
# 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
if "$VENV_PY" -m scripts.cli_entry --help >/dev/null 2>&1; then
echo "OK: 'python -m scripts.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
echo "ERROR: 'python -m scripts.cli_entry' failed in the venv despite .pth being written; aborting." >&2
exit 6
fi
else
@@ -385,7 +385,7 @@ PY
fi
else
echo "WARNING: Could not import 'medeia_macina.cli_entry' from the venv." >&2
echo "WARNING: Could not import 'scripts.cli_entry' from the venv." >&2
echo "Action: Try running: $VENV_PY -m pip install -e \"$REPO/scripts\" or inspect the venv site-packages to verify the installation." >&2
fi
@@ -532,7 +532,7 @@ if [[ "$DESKTOP" == "true" ]]; then
EXEC_PATH="$VENV_PATH/bin/mm"
if [[ ! -x "$EXEC_PATH" ]]; then
# fallback to python -m
EXEC_PATH="$VENV_PY -m medeia_macina.cli_entry"
EXEC_PATH="$VENV_PY -m scripts.cli_entry"
fi
APPDIR="$HOME/.local/share/applications"
@@ -628,7 +628,7 @@ if [ -n "${MM_DEBUG:-}" ]; then
import sys, importlib, traceback, importlib.util
print('sys.executable:', sys.executable)
print('sys.path (first 8):', sys.path[:8])
for mod in ('CLI','medeia_macina','medeia_macina.cli_entry'):
for mod in ('CLI','medeia_macina','scripts.cli_entry'):
try:
spec = importlib.util.find_spec(mod)
print(mod, 'spec:', spec)
@@ -646,10 +646,10 @@ fi
# 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 "$@"
exec "$VENV/bin/python3" -m scripts.cli_entry "$@"
fi
if [ -x "$VENV/bin/python" ]; then
exec "$VENV/bin/python" -m medeia_macina.cli_entry "$@"
exec "$VENV/bin/python" -m scripts.cli_entry "$@"
fi
# Fallback: packaged console script in the venv (older pip-generated wrapper)
@@ -659,11 +659,11 @@ 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 "$@"
exec python3 -m scripts.cli_entry "$@"
fi
if command -v python >/dev/null 2>&1; then
if python -c 'import sys; sys.exit(0 if sys.version_info[0] >= 3 else 1)'; then
exec python -m medeia_macina.cli_entry "$@"
exec python -m scripts.cli_entry "$@"
fi
fi
@@ -756,7 +756,7 @@ To activate the virtualenv:
source $VENV_PATH/bin/activate
To run the app:
$VENV_PATH/bin/mm # if installed as a console script
$VENV_PY -m medeia_macina.cli_entry # alternative
$VENV_PY -m scripts.cli_entry # alternative
Global launcher installed: $USER_BIN/mm