param( [string]$EnvName = "sensor-bench-build-py310" ) $ErrorActionPreference = "Stop" $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $DistDir = Join-Path $RepoRoot "dist" $WorkDir = Join-Path $RepoRoot "build\pyinstaller_work" $SpecPath = Join-Path $PSScriptRoot "sensor_bench.spec" if (-not (Get-Command conda -ErrorAction SilentlyContinue)) { throw "conda was not found on PATH. Open an Anaconda Prompt or initialize conda for PowerShell." } Push-Location $RepoRoot try { conda run -n $EnvName python -m pip install --upgrade pip conda run -n $EnvName python -m pip install -e ".[pack]" conda run -n $EnvName python -m pip install --upgrade orisys conda run -n $EnvName python tests/test_smoke.py if (Test-Path $WorkDir) { Remove-Item -Recurse -Force $WorkDir } if (Test-Path (Join-Path $DistDir "SensorBench")) { Remove-Item -Recurse -Force (Join-Path $DistDir "SensorBench") } conda run -n $EnvName python -m PyInstaller --noconfirm --clean --distpath "$DistDir" --workpath "$WorkDir" "$SpecPath" Copy-Item -Recurse -Force (Join-Path $RepoRoot "config") (Join-Path $DistDir "SensorBench") Copy-Item -Recurse -Force (Join-Path $RepoRoot "steps") (Join-Path $DistDir "SensorBench") conda run -n $EnvName python build/verify_dist.py Write-Host "Build complete: dist\SensorBench\SensorBench.exe" } finally { Pop-Location }