"""Resolve bundled resources and explicitly configured optional tools.""" import os from pathlib import Path ROOT = Path(__file__).resolve().parents[1] def configured_path(name, default, *, required=False): path = Path(os.environ.get(name, str(default))).expanduser() if not path.is_absolute(): path = ROOT / path if required and not path.exists(): raise FileNotFoundError(f"{name}: {path} is missing; configure {name} (see docs/INSTALL.md)") return path