fix: include KiCad 10 Windows install paths in library auto-discovery
Some checks failed
CI/CD Pipeline / TypeScript Build & Test (20.x, macos-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, ubuntu-22.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, ubuntu-24.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (20.x, windows-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, macos-latest) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, ubuntu-22.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, ubuntu-24.04) (push) Has been cancelled
CI/CD Pipeline / TypeScript Build & Test (22.x, windows-latest) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.10) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.11) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.12) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-22.04, 3.9) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.10) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.11) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.12) (push) Has been cancelled
CI/CD Pipeline / Python Tests (ubuntu-24.04, 3.9) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (10.0) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (8.0) (push) Has been cancelled
CI/CD Pipeline / Integration Tests (Linux + KiCAD) (9.0) (push) Has been cancelled
CI/CD Pipeline / Docker Build Test (push) Has been cancelled
CI/CD Pipeline / Code Quality (push) Has been cancelled
CI/CD Pipeline / Documentation Check (push) Has been cancelled

Fixes #245 — _find_kicad_footprint_dir() only listed the 9.0/8.0 Windows
install paths, so a Windows host with only KiCad 10 installed got None and
footprint auto-discovery found nothing. The same gap existed for symbols in
library_symbol.py and dynamic_symbol_loader.py.

- Add C:/Program Files/KiCad/10.0/share/kicad/{footprints,symbols} to the
  candidate lists (10.0 first, matching the existing newest-first order)
- Honor KICAD10_FOOTPRINT_DIR and KICAD10_SYMBOL_DIR env overrides alongside
  the existing 9/8 ones
- Regression tests in tests/test_kicad10_paths.py
This commit is contained in:
mixelpixx
2026-06-12 16:06:11 -04:00
parent 48f2d09fdd
commit 99b1d8a168
4 changed files with 74 additions and 20 deletions

View File

@@ -83,9 +83,7 @@ class SymbolLibraryManager:
logger.debug("Skipping unparseable library: %s", nickname)
logger.info("Symbol cache warm-up complete (%d libraries)", len(self.libraries))
threading.Thread(
target=_warm, name="symbol-cache-warmup", daemon=True
).start()
threading.Thread(target=_warm, name="symbol-cache-warmup", daemon=True).start()
def _load_libraries(self) -> None:
"""Load libraries from sym-lib-table files"""
@@ -232,12 +230,15 @@ class SymbolLibraryManager:
possible_paths = [
"/usr/share/kicad/symbols",
"/usr/local/share/kicad/symbols",
"C:/Program Files/KiCad/10.0/share/kicad/symbols",
"C:/Program Files/KiCad/9.0/share/kicad/symbols",
"C:/Program Files/KiCad/8.0/share/kicad/symbols",
"/Applications/KiCad/KiCad.app/Contents/SharedSupport/symbols",
]
# Check environment variable
if "KICAD10_SYMBOL_DIR" in os.environ:
possible_paths.insert(0, os.environ["KICAD10_SYMBOL_DIR"])
if "KICAD9_SYMBOL_DIR" in os.environ:
possible_paths.insert(0, os.environ["KICAD9_SYMBOL_DIR"])
if "KICAD8_SYMBOL_DIR" in os.environ:
@@ -610,8 +611,10 @@ class SymbolLibraryCommands:
# Patch (SER2RJ45): keep cache when project_path matches AND libraries were
# actually loaded. Original early-return skipped rebuild even when the cache
# was empty (e.g. first call after create_project, before sym-lib-table existed).
if (self.library_manager.project_path == project_path
and len(self.library_manager.libraries) > 0):
if (
self.library_manager.project_path == project_path
and len(self.library_manager.libraries) > 0
):
return
logger.info(f"Rebuilding SymbolLibraryManager for project: {project_path}")
self.library_manager = SymbolLibraryManager(project_path=project_path)