# Jarvis v2 M0 measurement kit - bootstrap (ASCII only on purpose: Windows # PowerShell 5.1 reads a BOM-less script in the ANSI code page). # # Installs uv and Python into the work folder, then runs m0.py. # Nothing is installed outside the work folder except what Strata's own # installer needs (it is pointed at the work folder too). param( [string]$WorkDir = "", [string]$Only = "", [string]$Skip = "", [switch]$Redo ) $ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 try { [Console]::OutputEncoding = [Text.UTF8Encoding]::new($false) } catch { } $Kit = Split-Path -Parent $MyInvocation.MyCommand.Path if (-not $WorkDir) { # A short path on the same drive as the kit: deep venv paths break under MAX_PATH. $WorkDir = Join-Path ([IO.Path]::GetPathRoot($Kit)) 'JarvisM0' } New-Item -ItemType Directory -Force -Path $WorkDir | Out-Null $WorkDir = (Resolve-Path $WorkDir).Path Write-Host "[M0] work folder: $WorkDir" $env:UV_CACHE_DIR = Join-Path $WorkDir 'cache\uv' $env:UV_PYTHON_INSTALL_DIR = Join-Path $WorkDir 'python' $env:UV_PYTHON_PREFERENCE = 'only-managed' $env:UV_LINK_MODE = 'copy' $env:PYTHONUTF8 = '1' $env:PYTHONIOENCODING = 'utf-8' $uvDir = Join-Path $WorkDir 'uv' $uv = Join-Path $uvDir 'uv.exe' if (-not (Test-Path $uv)) { Write-Host "[M0] downloading uv" New-Item -ItemType Directory -Force -Path $uvDir | Out-Null $zip = Join-Path $WorkDir 'uv.zip' Invoke-WebRequest -UseBasicParsing -Uri 'https://github.com/astral-sh/uv/releases/download/0.11.20/uv-x86_64-pc-windows-msvc.zip' -OutFile $zip Expand-Archive -Path $zip -DestinationPath $uvDir -Force Remove-Item $zip } $env:M0_UV = $uv $m0args = @('run', '--no-project', '--python', '3.12', (Join-Path $Kit 'm0.py'), '--work', $WorkDir) if ($Only) { $m0args += @('--only', $Only) } if ($Skip) { $m0args += @('--skip', $Skip) } if ($Redo) { $m0args += '--redo' } & $uv @m0args exit $LASTEXITCODE