Find build_info.json for a board, with optional example-specific search. Args: board: Board name example: Optional example name to search for build_info_{example}.json first Returns: Path to build_info.json file Raises: FileNotFoundError: If no build_in
(board: str, example: str | None = None)
| 18 | |
| 19 | |
| 20 | def _find_build_info(board: str, example: str | None = None) -> Path: |
| 21 | """Find build_info.json for a board, with optional example-specific search. |
| 22 | |
| 23 | Args: |
| 24 | board: Board name |
| 25 | example: Optional example name to search for build_info_{example}.json first |
| 26 | |
| 27 | Returns: |
| 28 | Path to build_info.json file |
| 29 | |
| 30 | Raises: |
| 31 | FileNotFoundError: If no build_info file found |
| 32 | """ |
| 33 | candidates: list[Path] = [] |
| 34 | |
| 35 | # If example provided, try example-specific files first |
| 36 | if example: |
| 37 | candidates.extend( |
| 38 | [ |
| 39 | Path(".build") / "pio" / board / f"build_info_{example}.json", |
| 40 | Path(".build") / board / f"build_info_{example}.json", |
| 41 | ] |
| 42 | ) |
| 43 | |
| 44 | # Always try generic build_info.json as fallback |
| 45 | candidates.extend( |
| 46 | [ |
| 47 | Path(".build") / "pio" / board / "build_info.json", |
| 48 | Path(".build") / board / "build_info.json", |
| 49 | ] |
| 50 | ) |
| 51 | |
| 52 | for candidate in candidates: |
| 53 | if candidate.exists(): |
| 54 | return candidate |
| 55 | |
| 56 | # Generate helpful error message |
| 57 | if example: |
| 58 | raise FileNotFoundError( |
| 59 | f"build_info.json not found for board '{board}' " |
| 60 | f"(tried build_info_{example}.json and build_info.json in .build/pio/{board} and .build/{board})" |
| 61 | ) |
| 62 | else: |
| 63 | raise FileNotFoundError( |
| 64 | f"build_info.json not found for board '{board}' in .build/pio/{board} or .build/{board}" |
| 65 | ) |
| 66 | |
| 67 | |
| 68 | def _run_pio_size(build_dir: Path) -> int | None: |
no outgoing calls
no test coverage detected