bootstrap(ps1): auto-remove interfering .pths when user accepts interactive fix or when -FixUrllib3 is used
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
nose
2025-12-24 02:59:42 -08:00
parent a2ba2ced08
commit 64aba67a31

View File

@@ -32,6 +32,10 @@ param(
[switch]$Quiet
)
# Track whether the user chose an interactive auto-fix (so we can auto-remove .pth files)
$AutoFixInteractive = $false
)
function Write-Log {
param([string]$msg,[string]$lvl="INFO")
if (-not $Quiet) {
@@ -294,6 +298,7 @@ print(json.dumps(out))"
}
$ans = Read-Host "Attempt automatic fix now? (y/N)"
if ($ans -eq 'y' -or $ans -eq 'Y') {
$AutoFixInteractive = $true
try { & $venvPython -m pip uninstall urllib3-future -y } catch {}
try { & $venvPython -m pip install --upgrade --force-reinstall urllib3 } catch { Write-Log "pip install failed: $_" "ERROR"; exit 7 }
try { & $venvPython -m pip install niquests -U } catch { Write-Log "pip install niquests failed: $_" "ERROR" }
@@ -308,8 +313,8 @@ print(json.dumps(out))"
exit 7
}
Write-Log ("Found interfering .pth files:`n" + ($pths -join "`n")) "ERROR"
if ($RemovePth) {
Write-Log "Removing .pth files as requested..." "INFO"
if ($RemovePth -or $AutoFixInteractive -or $FixUrllib3) {
Write-Log "Removing .pth files automatically..." "INFO"
if (RemovePthAndVerify -python $venvPython -paths $pths) {
Write-Log "Success: urllib3 problems resolved after .pth removal; continuing." "INFO"
} else {