Refuse to proceed if `fbuild symbols` isn't wired up.
()
| 140 | |
| 141 | |
| 142 | def assert_fbuild_has_symbols() -> None: |
| 143 | """Refuse to proceed if `fbuild symbols` isn't wired up.""" |
| 144 | try: |
| 145 | out = subprocess.check_output( |
| 146 | ["fbuild", "symbols", "--help"], |
| 147 | stderr=subprocess.STDOUT, |
| 148 | text=True, |
| 149 | timeout=15, |
| 150 | ) |
| 151 | except FileNotFoundError as e: |
| 152 | raise SystemExit( |
| 153 | "Bloat: `fbuild` not on PATH. Run from a uv-managed shell " |
| 154 | "(`uv run bash bloat <board>` or set the project venv)." |
| 155 | ) from e |
| 156 | except subprocess.CalledProcessError as e: |
| 157 | raise SystemExit( |
| 158 | "Bloat: `fbuild symbols` rejected. Your installed fbuild " |
| 159 | "doesn't carry the symbols subcommand. Reinstall project " |
| 160 | "dependencies (`uv sync`) — pyproject.toml pins a release " |
| 161 | "that ships symbols/bloat. See agents/docs/binary-size-" |
| 162 | "analysis.md for the upgrade path.\n\n" |
| 163 | f"Output:\n{e.output}" |
| 164 | ) from e |
| 165 | if "symbols" not in out.lower() and "bloat" not in out.lower(): |
| 166 | # Sanity-check that the help text describes the right surface. |
| 167 | raise SystemExit( |
| 168 | "Bloat: `fbuild symbols --help` returned but doesn't mention " |
| 169 | "the symbols/bloat subcommand. Likely a stale fbuild binary." |
| 170 | ) |
| 171 | |
| 172 | |
| 173 | def run_fbuild_symbols(elf: Path, nm: Path, out_dir: Path, top: int) -> None: |