fix(setup): detect KiCAD on any drive and pin bundled Python for v10 - #356
fix(setup): detect KiCAD on any drive and pin bundled Python for v10#356LiJoeAllen wants to merge 2 commits into
Conversation
- Find KiCAD via registry uninstall keys (InstallLocation/DisplayIcon) and KICAD*_* environment variables, so installs outside C: drive (e.g. D:\Program Files\KiCad) are found for all-users setups - Fall back to bin\Lib\site-packages when lib\python3\dist-packages is missing (KiCad 10 uses the bin layout) - Set KICAD_PYTHON in generated MCP configs so KiCad 10 always uses the bundled python.exe from the install directory
|
Reviewed — the approach is sound, and most of it back-ports detection logic that setup-windows-opencode.ps1 already has (its Get-KiCadInfo at line 187 has the same dist-packages -> site-packages fallback), so the pattern is established in-repo. The registry enumeration order (HKLM, WOW6432Node, HKCU, then KICAD*_* env vars, then the Program Files list) is right. And you incidentally fixed a real latent bug: the original $possiblePaths array was missing a comma after the (x86) entry, masked by PowerShell's newline separation. Three concrete changes:
Verification is necessarily anecdotal for setup scripts (CI has no D: drive); with the three items fixed I am comfortable merging on your D:-install evidence plus a re-test on a stock C: install. |
…inning Address maintainer review on PR mixelpixx#356: - Walk up one level from the DisplayIcon bin directory so <root>\bin\kicad.exe resolves to the version root instead of probing <root>\bin\bin\python.exe (both scripts) - Hoist $script:KnownVersions to script scope so Get-KiCadInfo does not depend on Find-KiCAD having run first - Add the bin\Python.exe case-variant candidate to setup-windows.ps1 Get-KiCadInfo so probing matches setup-windows-opencode.ps1, with cross-reference comments in both
…inning Address maintainer review on PR mixelpixx#356: - Walk up one level from the DisplayIcon bin directory so <root>\bin\kicad.exe resolves to the version root instead of probing <root>\bin\bin\python.exe (both scripts) - Hoist $script:KnownVersions to script scope so Get-KiCadInfo does not depend on Find-KiCAD having run first - Add the bin\Python.exe case-variant candidate to setup-windows.ps1 Get-KiCadInfo so probing matches setup-windows-opencode.ps1, with cross-reference comments in both
…inning Address maintainer review on PR mixelpixx#356: - Walk up one level from the DisplayIcon bin directory so <root>\bin\kicad.exe resolves to the version root instead of probing <root>\bin\bin\python.exe (both scripts) - Hoist $script:KnownVersions to script scope so Get-KiCadInfo does not depend on Find-KiCAD having run first - Add the bin\Python.exe case-variant candidate to setup-windows.ps1 Get-KiCadInfo so probing matches setup-windows-opencode.ps1, with cross-reference comments in both
|
Thanks for the thorough review - all three items are addressed in a30be1a:
Verification:
I can't spin up a real C: install on this machine, but the simulated layout |
Fixes two issues with the Windows setup scripts for KiCAD 10:
KiCAD detection no longer assumes C: drive. All-users installs can land on any drive; detection now queries registry uninstall keys (InstallLocation/DisplayIcon) and KICAD*_* environment variables before falling back to the standard paths.
KiCAD 10 must use the bundled python from its install directory. Generated MCP configs now set KICAD_PYTHON to the detected bin\python.exe, and site-packages falls back to bin\Lib\site-packages when lib\python3\dist-packages is absent (the KiCad 10 layout).
Verified on a machine with KiCAD 10.0 at D:\Program Files\KiCad (detected via registry, pcbnew import works).