Merge urllib3 fix into bootstraps; remove helper scripts
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:
@@ -27,6 +27,7 @@ param(
|
||||
[switch]$NoInstall,
|
||||
[switch]$NoPlaywright,
|
||||
[string]$PlaywrightBrowsers = "chromium",
|
||||
[switch]$FixUrllib3,
|
||||
[switch]$Quiet
|
||||
)
|
||||
|
||||
@@ -191,8 +192,41 @@ if (-not $NoInstall) {
|
||||
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
|
||||
|
||||
if ($FixUrllib3) {
|
||||
Write-Log "Attempting automatic fix (--FixUrllib3)..." "INFO"
|
||||
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" }
|
||||
& $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 "Automatic fix failed; aborting." "ERROR"
|
||||
exit 7
|
||||
} else {
|
||||
Write-Log "Success: urllib3 problems appear resolved; continuing." "INFO"
|
||||
}
|
||||
} else {
|
||||
if ($Quiet) {
|
||||
Write-Log "Bootstrap detected a potentially broken 'urllib3' installation. Use -FixUrllib3 to attempt an automatic fix." "ERROR"
|
||||
exit 7
|
||||
}
|
||||
$ans = Read-Host "Attempt automatic fix now? (y/N)"
|
||||
if ($ans -eq 'y' -or $ans -eq 'Y') {
|
||||
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" }
|
||||
& $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 "Automatic fix failed; aborting." "ERROR"
|
||||
exit 7
|
||||
} else {
|
||||
Write-Log "Success: urllib3 problems appear resolved; continuing." "INFO"
|
||||
}
|
||||
} else {
|
||||
Write-Log "Aborting bootstrap to avoid leaving a broken environment." "ERROR"
|
||||
exit 7
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Log "Failed to run environment verification: $_" "ERROR"
|
||||
|
||||
Reference in New Issue
Block a user