Fix the two macOS field-test failures: backend order, RO board dir
Build PCM package / build (push) Successful in 5s
Build PCM package / build (push) Successful in 5s
Second Mac run (KiCad demo board opened from the mounted installer image) got past the dialog and died twice: 1. make_output_dir crashed with OSError 30: the demos volume is a read-only filesystem. Now falls back to a temp directory named after the board, with the path printed (the Messages panel showed it is actually read there). 2. The error figure - and every other figure - could never render: matplotlib refused with Cannot load backend TkAgg ... as qt is currently running. macOS bundled Python ships tkinter, so the old tk-first probe picked TkAgg while the PySide6 dialog and progress window had already made this a Qt process. Windows never saw it because KiCad Python there has no tkinter. Qt now comes first - PySide6 is a hard dependency, so it is always there. Both covered by tests that fail on the old code: the dev env has both toolkits installed, so the backend-order assertion is exercised for real, and the RO fallback is simulated by denying mkdir under the board dir. 140 passed on the dev stack and on the Python 3.9 + numpy 2.0 / scipy 1.13 / matplotlib 3.9 / PySide6 6.10 stack that a Mac venv resolves. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Output directory, summary.txt, geometry dump, stdout one-liner."""
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
@@ -14,8 +15,20 @@ from .solver import Result
|
||||
|
||||
def make_output_dir(board_dir: Path) -> Path:
|
||||
stamp = datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||
out = Path(board_dir) / config.OUTPUT_DIRNAME / stamp
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
board_dir = Path(board_dir)
|
||||
out = board_dir / config.OUTPUT_DIRNAME / stamp
|
||||
try:
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
except OSError as e:
|
||||
# The board can live somewhere unwritable - e.g. the demos
|
||||
# folder on the mounted KiCad installer image (read-only, and
|
||||
# how the first macOS field test was run). Results still have
|
||||
# to land somewhere the figures/summary can be written.
|
||||
out = (Path(tempfile.gettempdir()) / config.OUTPUT_DIRNAME
|
||||
/ f"{board_dir.name}-{stamp}")
|
||||
print(f"board directory not writable ({e}); saving results to "
|
||||
f"{out}")
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
return out
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user