Locate the most specific ``build_info_*.json`` for (board, example, backend). Search order: 1. ``.build/pio/ /build_info_ .json`` (both backends) 2. ``.build/pio/ /build_info.json`` 3. `` /build_info_ .json`` (fbuild top-level dump)
(
project_root: Path, board: str, example: str, backend: str
)
| 395 | |
| 396 | |
| 397 | def _find_build_info( |
| 398 | project_root: Path, board: str, example: str, backend: str |
| 399 | ) -> Path | None: |
| 400 | """Locate the most specific ``build_info_*.json`` for (board, example, backend). |
| 401 | |
| 402 | Search order: |
| 403 | 1. ``.build/pio/<board>/build_info_<example>.json`` (both backends) |
| 404 | 2. ``.build/pio/<board>/build_info.json`` |
| 405 | 3. ``<project_root>/build_info_<board>.json`` (fbuild top-level dump) |
| 406 | 4. ``<project_root>/build_info.json`` (fbuild generic dump) |
| 407 | |
| 408 | The ``backend`` arg is kept for future use (e.g. backend-specific |
| 409 | suffixes) but currently both backends write into the same |
| 410 | ``.build/pio/<board>/`` directory because that's the convention |
| 411 | ``generate_build_info_json_from_existing_build`` uses. |
| 412 | """ |
| 413 | del backend # reserved for future use |
| 414 | candidates: list[Path] = [ |
| 415 | project_root / ".build" / "pio" / board / f"build_info_{example}.json", |
| 416 | project_root / ".build" / "pio" / board / "build_info.json", |
| 417 | project_root / f"build_info_{board}.json", |
| 418 | project_root / "build_info.json", |
| 419 | ] |
| 420 | for c in candidates: |
| 421 | if c.exists(): |
| 422 | return c |
| 423 | return None |
| 424 | |
| 425 | |
| 426 | # --------------------------------------------------------------------------- |