From 2ba873b93a2b7c915a33bd00fd2fb542e47e78c7 Mon Sep 17 00:00:00 2001 From: ethernet Date: Thu, 24 Sep 2026 13:53:57 -0400 Subject: [PATCH] fix(install.ps1): resolve the bootstrap Python once per process The full ladder runs every stage in one PowerShell process, and venv, python-deps, source completion and launcher publication each called Get-BootstrapPython, repeating the uv probe and `uv python find`. Memoize the resolved interpreter in script scope. The existing find-before-install order is unchanged. --- scripts/install.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index a1c692a23c..eebcd538d1 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -771,6 +771,9 @@ function Stage-Venv { # This tool-only bootstrap runs before PM's own dependencies exist. pm.cli # prepares and enters its independently locked runtime before installing apps. function Get-BootstrapPython { + # The full ladder runs every stage in one process and four of them need + # this interpreter; resolve uv and Python once per process. + if ($script:BootstrapPython) { return $script:BootstrapPython } $uv = Get-Uv $lock = Get-Content (Join-Path $InstallDir "pm\lock.json") -Raw | ConvertFrom-Json $pyPin = $lock.packages.python @@ -785,7 +788,8 @@ function Get-BootstrapPython { $bootPy = (Invoke-Native { & $uv python find --managed-python --no-project $pyRequest }) -join "`n" } if ($LASTEXITCODE -or -not $bootPy) { Fail "bootstrap Python lookup failed" } - return $bootPy.Trim() + $script:BootstrapPython = $bootPy.Trim() + return $script:BootstrapPython } function Invoke-BootstrapPm {