d
This commit is contained in:
@@ -580,11 +580,44 @@ if (Test-Path (Join-Path $repo 'CLI.py')) { & python (Join-Path $repo 'CLI.py')
|
||||
# fallback
|
||||
python -m medeia_macina.cli_entry @args
|
||||
'@
|
||||
# Inject the actual repo path safely (escape embedded double-quotes if any)
|
||||
# Thin wrapper: prefer the canonical Python bootstrap installer
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repo = (Resolve-Path (Join-Path $scriptDir "..")).Path
|
||||
$venvPy = Join-Path $repo '.venv\Scripts\python.exe'
|
||||
|
||||
# Normalize incoming quiet flag (-Quiet) into -q for the Python script
|
||||
$forwardArgs = @()
|
||||
foreach ($a in $args) {
|
||||
if ($a -eq '-Quiet') { $forwardArgs += '-q' } else { $forwardArgs += $a }
|
||||
}
|
||||
|
||||
# Debug helper
|
||||
if ($env:MM_DEBUG) { Write-Host "MM_DEBUG: invoking python installer with args: $forwardArgs" -ForegroundColor Yellow }
|
||||
|
||||
if (Test-Path $venvPy) {
|
||||
& $venvPy (Join-Path $repo 'scripts\bootstrap.py') --no-delegate @forwardArgs
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
# Fall back to any system Python (py -3 -> python3 -> python)
|
||||
if (Get-Command -Name py -ErrorAction SilentlyContinue) {
|
||||
& py -3 (Join-Path $repo 'scripts\bootstrap.py') --no-delegate @forwardArgs
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
if (Get-Command -Name python3 -ErrorAction SilentlyContinue) {
|
||||
& python3 (Join-Path $repo 'scripts\bootstrap.py') --no-delegate @forwardArgs
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
if (Get-Command -Name python -ErrorAction SilentlyContinue) {
|
||||
& python (Join-Path $repo 'scripts\bootstrap.py') --no-delegate @forwardArgs
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Host 'Error: no suitable Python 3 interpreter found. Please install Python 3 or use the venv.' -ForegroundColor Red
|
||||
exit 127 # Inject the actual repo path safely (escape embedded double-quotes if any)
|
||||
$ps1Text = $ps1Text.Replace('__REPO__', $repo.Replace('"', '""'))
|
||||
# Ensure the PowerShell shim falls back to the correct module when the venv isn't present
|
||||
$ps1Text = $ps1Text.Replace(' -m medeia_entry ', ' -m medeia_macina.cli_entry ')
|
||||
$ps1Text = $ps1Text.Replace('python -m medeia_entry', 'python -m medeia_macina.cli_entry')
|
||||
# (No legacy 'medeia_entry' shim - use the packaged entry 'medeia_macina.cli_entry')
|
||||
if (Test-Path $mmPs1) {
|
||||
$bak = "$mmPs1.bak$(Get-Date -UFormat %s)"
|
||||
Move-Item -Path $mmPs1 -Destination $bak -Force
|
||||
|
||||
Reference in New Issue
Block a user