hjhj
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:
@@ -313,8 +313,12 @@ python $cli @args
|
||||
f"@echo off\r\n"
|
||||
f"set REPO={repo}\r\n"
|
||||
f"if exist \"%REPO%\\.venv\\Scripts\\mm.exe\" \"%REPO%\\.venv\\Scripts\\mm.exe\" %*\r\n"
|
||||
f"if exist \"%REPO%\\.venv\\Scripts\\python.exe\" \"%REPO%\\.venv\\Scripts\\python.exe\" -m medeia_entry %*\r\n"
|
||||
f"python -m medeia_entry %*\r\n"
|
||||
f"if defined MM_DEBUG (\r\n"
|
||||
f" echo MM_DEBUG: REPO=%REPO%\r\n"
|
||||
f" if exist \"%REPO%\\.venv\\Scripts\\python.exe\" \"%REPO%\\.venv\\Scripts\\python.exe\" -c \"import sys,importlib,importlib.util; print('sys.executable:', sys.executable); print('sys.path (first 8):', sys.path[:8]);\" \r\n"
|
||||
f")\r\n"
|
||||
f"if exist \"%REPO%\\.venv\\Scripts\\python.exe\" \"%REPO%\\.venv\\Scripts\\python.exe\" -m medeia_macina.cli_entry %*\r\n"
|
||||
f"python -m medeia_macina.cli_entry %*\r\n"
|
||||
)
|
||||
if mm_cmd.exists():
|
||||
bak = mm_cmd.with_suffix(f".bak{int(time.time())}")
|
||||
@@ -330,8 +334,14 @@ python $cli @args
|
||||
"$exe = Join-Path $venv 'Scripts\\mm.exe'\n"
|
||||
"if (Test-Path $exe) { & $exe @args; exit $LASTEXITCODE }\n"
|
||||
"$py = Join-Path $venv 'Scripts\\python.exe'\n"
|
||||
"if (Test-Path $py) { & $py -m medeia_entry @args; exit $LASTEXITCODE }\n"
|
||||
"python -m medeia_entry @args\n"
|
||||
"if (Test-Path $py) {\n"
|
||||
" if ($env:MM_DEBUG) {\n"
|
||||
" Write-Host \"MM_DEBUG: diagnostics\" -ForegroundColor Yellow\n"
|
||||
" & $py -c \"import sys,importlib,importlib.util,traceback; print('sys.executable:', sys.executable); print('sys.path (first 8):', sys.path[:8]);\"\n"
|
||||
" }\n"
|
||||
" & $py -m medeia_macina.cli_entry @args; exit $LASTEXITCODE\n"
|
||||
"}\n"
|
||||
"python -m medeia_macina.cli_entry @args\n"
|
||||
)
|
||||
if mm_ps1.exists():
|
||||
bak = mm_ps1.with_suffix(f".bak{int(time.time())}")
|
||||
@@ -364,9 +374,14 @@ python $cli @args
|
||||
"#!/usr/bin/env bash\n"
|
||||
"set -e\n"
|
||||
f"REPO=\"{repo}\"\n"
|
||||
"# If the packaged REPO does not look valid at runtime, try to locate the repo by walking\n"
|
||||
"# up from the current working directory so the launcher works when executed inside the\n"
|
||||
"# project tree or when the global bin is symlinked into the repo.\n"
|
||||
"# Prefer git top-level when available to avoid embedding a parent path.\n"
|
||||
"if command -v git >/dev/null 2>&1; then\n"
|
||||
" gitroot=$(git -C \"$REPO\" rev-parse --show-toplevel 2>/dev/null || true)\n"
|
||||
" if [ -n \"$gitroot\" ]; then\n"
|
||||
" REPO=\"$gitroot\"\n"
|
||||
" fi\n"
|
||||
"fi\n"
|
||||
"# If git not available or didn't resolve, walk up from CWD to find a project root.\n"
|
||||
"if [ ! -f \"$REPO/CLI.py\" ] && [ ! -f \"$REPO/pyproject.toml\" ]; then\n"
|
||||
" CUR=\"$(pwd -P)\"\n"
|
||||
" while [ \"$CUR\" != \"/\" ] && [ \"$CUR\" != \"\" ]; do\n"
|
||||
@@ -378,15 +393,38 @@ python $cli @args
|
||||
" done\n"
|
||||
"fi\n"
|
||||
"VENV=\"$REPO/.venv\"\n"
|
||||
"# Debug mode: set MM_DEBUG=1 to print repository, venv, and import diagnostics\n"
|
||||
"if [ -n \"${MM_DEBUG:-}\" ]; then\n"
|
||||
" echo \"MM_DEBUG: diagnostics\" >&2\n"
|
||||
" echo \"Resolved REPO: $REPO\" >&2\n"
|
||||
" echo \"Resolved VENV: $VENV\" >&2\n"
|
||||
" echo \"VENV exists: $( [ -d \"$VENV\" ] && echo yes || echo no )\" >&2\n"
|
||||
" echo \"Candidates:\" >&2\n"
|
||||
" echo \" VENV/bin/mm: $( [ -x \"$VENV/bin/mm\" ] && echo yes || echo no )\" >&2\n"
|
||||
" echo \" VENV/bin/python3: $( [ -x \"$VENV/bin/python3\" ] && echo yes || echo no )\" >&2\n"
|
||||
" echo \" VENV/bin/python: $( [ -x \"$VENV/bin/python\" ] && echo yes || echo no )\" >&2\n"
|
||||
" echo \" system python3: $(command -v python3 || echo none)\" >&2\n"
|
||||
" echo \" system python: $(command -v python || echo none)\" >&2\n"
|
||||
" for pycmd in \"$VENV/bin/python3\" \"$VENV/bin/python\" \"$(command -v python3 2>/dev/null)\" \"$(command -v python 2>/dev/null)\"; do\n"
|
||||
" if [ -n \"$pycmd\" ] && [ -x \"$pycmd\" ]; then\n"
|
||||
" echo \"---- Testing with: $pycmd ----\" >&2\n"
|
||||
" $pycmd - <<'PY'\nimport sys, importlib, traceback, importlib.util\nprint('sys.executable:', sys.executable)\nprint('sys.path (first 8):', sys.path[:8])\nfor mod in ('CLI','medeia_macina','medeia_macina.cli_entry'):\n try:\n spec = importlib.util.find_spec(mod)\n print(mod, 'spec:', spec)\n if spec:\n m = importlib.import_module(mod)\n print(mod, 'loaded at', getattr(m, '__file__', None))\n except Exception:\n print(mod, 'import failed')\n traceback.print_exc()\nPY\n"
|
||||
" fi\n"
|
||||
" done\n"
|
||||
" echo \"MM_DEBUG: end diagnostics\" >&2\n"
|
||||
"fi\n"
|
||||
"# Packaged console script in the venv if available\n"
|
||||
"if [ -x \"$VENV/bin/mm\" ]; then\n"
|
||||
" exec \"$VENV/bin/mm\" \"$@\"\n"
|
||||
"fi\n"
|
||||
"# Prefer venv's python3, then venv's python\n"
|
||||
"if [ -x \"$VENV/bin/python3\" ]; then\n"
|
||||
" exec \"$VENV/bin/python3\" -m medeia_macina.cli_entry \"$@\"\n"
|
||||
"fi\n"
|
||||
"if [ -x \"$VENV/bin/python\" ]; then\n"
|
||||
" exec \"$VENV/bin/python\" -m medeia_macina.cli_entry \"$@\"\n"
|
||||
"fi\n"
|
||||
"# Fallback to system python3, then system python (only if it's Python 3)\n"
|
||||
"if command -v python3 >/dev/null 2>&1; then\n"
|
||||
" exec python3 -m medeia_macina.cli_entry \"$@\"\n"
|
||||
"fi\n"
|
||||
|
||||
Reference in New Issue
Block a user