h
This commit is contained in:
@@ -800,10 +800,10 @@ $venvScripts = Join-Path $venv 'Scripts'
|
||||
if (Test-Path $venvScripts) { $env:PATH = $venvScripts + ';' + $env:PATH }
|
||||
$py = Join-Path $venv 'Scripts\python.exe'
|
||||
$cli = Join-Path $repo 'CLI.py'
|
||||
if (Test-Path $py) { & $py -m medeia_macina.cli_entry @args; exit $LASTEXITCODE }
|
||||
if (Test-Path $py) { & $py -m scripts.cli_entry @args; exit $LASTEXITCODE }
|
||||
if (Test-Path $cli) { & python $cli @args; exit $LASTEXITCODE }
|
||||
# fallback
|
||||
python -m medeia_macina.cli_entry @args
|
||||
python -m scripts.cli_entry @args
|
||||
"""
|
||||
try:
|
||||
ps1.write_text(ps1_text, encoding="utf-8")
|
||||
@@ -836,9 +836,9 @@ python -m medeia_macina.cli_entry @args
|
||||
' 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"
|
||||
" & $py -m scripts.cli_entry @args; exit $LASTEXITCODE\n"
|
||||
"}\n"
|
||||
"python -m medeia_macina.cli_entry @args\n"
|
||||
"python -m scripts.cli_entry @args\n"
|
||||
)
|
||||
if mm_ps1.exists():
|
||||
bak = mm_ps1.with_suffix(f".bak{int(time.time())}")
|
||||
@@ -916,7 +916,7 @@ python -m medeia_macina.cli_entry @args
|
||||
' 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"
|
||||
" $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','scripts.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'
|
||||
@@ -927,18 +927,18 @@ python -m medeia_macina.cli_entry @args
|
||||
"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'
|
||||
' exec "$VENV/bin/python3" -m scripts.cli_entry "$@"\n'
|
||||
"fi\n"
|
||||
'if [ -x "$VENV/bin/python" ]; then\n'
|
||||
' exec "$VENV/bin/python" -m medeia_macina.cli_entry "$@"\n'
|
||||
' exec "$VENV/bin/python" -m scripts.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'
|
||||
' exec python3 -m scripts.cli_entry "$@"\n'
|
||||
"fi\n"
|
||||
"if command -v python >/dev/null 2>&1; then\n"
|
||||
" if python -c 'import sys; sys.exit(0 if sys.version_info[0] >= 3 else 1)'; then\n"
|
||||
' exec python -m medeia_macina.cli_entry "$@"\n'
|
||||
' exec python -m scripts.cli_entry "$@"\n'
|
||||
" fi\n"
|
||||
"fi\n"
|
||||
"echo 'Error: no suitable Python 3 interpreter found. Please install Python 3 or use the venv.' >&2\n"
|
||||
|
||||
Reference in New Issue
Block a user