Resolve the ``fbuild`` executable for the active Python environment. Prefer the sibling script next to the current interpreter so ``uv run`` reliably uses the version locked in this repo's virtualenv instead of an older global ``fbuild`` earlier on ``PATH``.
()
| 80 | |
| 81 | |
| 82 | def get_fbuild_executable() -> str | None: |
| 83 | """Resolve the ``fbuild`` executable for the active Python environment. |
| 84 | |
| 85 | Prefer the sibling script next to the current interpreter so ``uv run`` |
| 86 | reliably uses the version locked in this repo's virtualenv instead of an |
| 87 | older global ``fbuild`` earlier on ``PATH``. |
| 88 | """ |
| 89 | script_dir = Path(sys.executable).resolve().parent |
| 90 | candidates = [ |
| 91 | script_dir / "fbuild", |
| 92 | script_dir / "fbuild.exe", |
| 93 | ] |
| 94 | for candidate in candidates: |
| 95 | if candidate.exists(): |
| 96 | return str(candidate) |
| 97 | return shutil.which("fbuild") |
| 98 | |
| 99 | |
| 100 | def fbuild_subprocess_env() -> dict[str, str]: |
no test coverage detected