khh
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
nose
2025-12-24 02:13:21 -08:00
parent 8bf04c6b71
commit 24dd18de7e
20 changed files with 1792 additions and 636 deletions

View File

@@ -25,6 +25,8 @@ param(
[string]$Python = "",
[switch]$Force,
[switch]$NoInstall,
[switch]$NoPlaywright,
[string]$PlaywrightBrowsers = "chromium",
[switch]$Quiet
)
@@ -146,17 +148,56 @@ if (-not $NoInstall) {
} catch {
Write-Log "pip install failed: $_" "ERROR"; exit 6
}
} else {
Write-Log "Skipping install (--NoInstall set)"
}
# Install Deno (official installer) - installed automatically
try {
$denoCmd = Get-Command 'deno' -ErrorAction SilentlyContinue
} catch {
$denoCmd = $null
}
if ($denoCmd) {
# Install Playwright browsers (default: chromium) unless explicitly disabled
if (-not $NoPlaywright) {
Write-Log "Ensuring Playwright browsers are installed (browsers=$PlaywrightBrowsers)..."
try {
& $venvPython -c "import importlib; importlib.import_module('playwright')" 2>$null
if ($LASTEXITCODE -ne 0) {
Write-Log "'playwright' package not found in venv; installing via pip..."
& $venvPython -m pip install playwright
}
} catch {
Write-Log "Failed to check/install 'playwright' package: $_" "ERROR"
}
try {
if ($PlaywrightBrowsers -eq 'all') {
Write-Log "Installing all Playwright browsers..."
& $venvPython -m playwright install
} else {
$list = $PlaywrightBrowsers -split ','
foreach ($b in $list) {
$btrim = $b.Trim()
if ($btrim) {
Write-Log "Installing Playwright browser: $btrim"
& $venvPython -m playwright install $btrim
}
}
}
} catch {
Write-Log "Playwright browser install failed: $_" "ERROR"
}
}
# Verify environment for known package conflicts (urllib3 compatibility)
Write-Log "Verifying environment for known package conflicts (urllib3 compatibility)..."
try {
& $venvPython -c "import sys; from SYS.env_check import check_urllib3_compat; ok, msg = check_urllib3_compat(); print(msg); sys.exit(0 if ok else 2)"
if ($LASTEXITCODE -ne 0) {
Write-Log "Bootstrap detected a potentially broken 'urllib3' installation. See message above." "ERROR"
Write-Log "Suggested fixes (activate the venv first):" "INFO"
Write-Log " $ $venvPython -m pip uninstall urllib3-future -y" "INFO"
Write-Log " $ $venvPython -m pip install --upgrade --force-reinstall urllib3" "INFO"
Write-Log " $ $venvPython -m pip install niquests -U" "INFO"
Write-Log "Aborting bootstrap to avoid leaving a broken environment." "ERROR"
exit 7
}
} catch {
Write-Log "Failed to run environment verification: $_" "ERROR"
}
Write-Log "Deno is already installed: $($denoCmd.Path)"
} else {
Write-Log "Installing Deno via official installer (https://deno.land)"
@@ -242,12 +283,12 @@ try {
$cmdText = @"
@echo off
set "REPO=__REPO__"
if exist "%REPO%\.venv\Scripts\mm.exe" (
"%REPO%\.venv\Scripts\mm.exe" %*
if exist "%REPO%\.venv\Scripts\python.exe" (
"%REPO%\.venv\Scripts\python.exe" "%REPO%\CLI.py" %*
exit /b %ERRORLEVEL%
)
if exist "%REPO%\.venv\Scripts\python.exe" (
"%REPO%\.venv\Scripts\python.exe" -m medeia_macina.cli_entry %*
if exist "%REPO%\CLI.py" (
python "%REPO%\CLI.py" %*
exit /b %ERRORLEVEL%
)
python -m medeia_macina.cli_entry %*
@@ -266,12 +307,12 @@ python -m medeia_macina.cli_entry %*
Param([Parameter(ValueFromRemainingArguments=$true)] $args)
$repo = "__REPO__"
$venv = Join-Path $repo '.venv'
$exe = Join-Path $venv 'Scripts\mm.exe'
if (Test-Path $exe) { & $exe @args; exit $LASTEXITCODE }
$py = Join-Path $venv 'Scripts\python.exe'
if (Test-Path $py) { & $py -m medeia_entry @args; exit $LASTEXITCODE }
$cli = Join-Path $repo 'CLI.py'
if (Test-Path $py) { & $py $cli @args; exit $LASTEXITCODE }
if (Test-Path $cli) { & $py $cli @args; exit $LASTEXITCODE }
# fallback
python -m medeia_entry @args
python $cli @args
'@
# Inject the actual repo path safely (escape embedded double-quotes if any)
$ps1Text = $ps1Text.Replace('__REPO__', $repo.Replace('"', '""'))