bootstrap_oss_cad_suite.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. #!/usr/bin/env python3
  2. """Explicit OSS CAD Suite bootstrap helper for Prod2U P4 verification.
  3. This script is intentionally not called by the normal harness. It never
  4. installs tools implicitly; the user must run it directly and choose a download
  5. or extraction action.
  6. """
  7. from __future__ import annotations
  8. import argparse
  9. import hashlib
  10. import json
  11. import shutil
  12. import sys
  13. import urllib.request
  14. import zipfile
  15. import subprocess
  16. from pathlib import Path
  17. from typing import Any
  18. DEFAULT_TOOLCHAIN_BASE = Path.home() / "CodexToolchains" / "CPLD"
  19. DEFAULT_ROOT = DEFAULT_TOOLCHAIN_BASE / "oss-cad-suite" / "latest"
  20. DEFAULT_DOWNLOAD_DIR = DEFAULT_TOOLCHAIN_BASE / "downloads"
  21. DEFAULT_COCOTB_VENV = (
  22. DEFAULT_TOOLCHAIN_BASE / "venvs" / "prod2u-p4-actuator-trace-cocotb-venv"
  23. )
  24. DEFAULT_BUNDLED_PYTHON = Path.home() / ".cache" / "codex-runtimes" / "codex-primary-runtime" / "dependencies" / "python" / "python.exe"
  25. DEFAULT_COCOTB_VERSION = "1.9.2"
  26. DEFAULT_EXTRA_PYTHON_PACKAGES = ["pytest", "hypothesis", "pyserial", "pyserial-asyncio"]
  27. OWNER_MARKER_NAME = ".cpld_toolchain_owner.json"
  28. INSTALL_MANIFEST_NAME = ".cpld_toolchain_manifest.json"
  29. TOOLCHAIN_SHIM_DIR = Path(__file__).resolve().parent / "toolchain_shims"
  30. VERILATOR_SHIM = TOOLCHAIN_SHIM_DIR / "verilator.ps1"
  31. ACTIVATION_SCRIPT = Path(__file__).resolve().parent / "activate_verification_toolchain.ps1"
  32. RELEASES_URL = "https://github.com/YosysHQ/oss-cad-suite-build/releases"
  33. LATEST_API_URL = "https://api.github.com/repos/YosysHQ/oss-cad-suite-build/releases/latest"
  34. REQUIRED_TOOLS = ["iverilog", "vvp", "verilator", "yosys", "sby"]
  35. def tool_status(root: Path) -> dict[str, Any]:
  36. bin_dir = root / "bin"
  37. tools = {}
  38. for name in REQUIRED_TOOLS:
  39. if name == "verilator":
  40. candidates = (bin_dir / "verilator_bin.exe", bin_dir / "verilator.exe")
  41. else:
  42. candidates = (bin_dir / f"{name}.exe", bin_dir / name)
  43. path = next((candidate for candidate in candidates if candidate.is_file()), None)
  44. tools[name] = {
  45. "status": "present" if path is not None else "missing",
  46. "path": str(path.resolve()) if path is not None else None,
  47. }
  48. return {
  49. "schema": "prod2u-p4-actuator-trace-oss-cad-suite-bootstrap-v1",
  50. "install_root": str(root),
  51. "owner_marker": str(root / OWNER_MARKER_NAME),
  52. "bin_dir": str(bin_dir),
  53. "tools": tools,
  54. "releases_url": RELEASES_URL,
  55. "env": {
  56. "PROD2U_P4_TOOLCHAIN_ROOT": str(root),
  57. "OSS_CAD_SUITE_ROOT": str(root),
  58. "VERILATOR": tools["verilator"]["path"],
  59. "path_addition": str(bin_dir),
  60. },
  61. "authority_boundary": "This helper only downloads/extracts a user-selected OSS CAD Suite archive; it does not prove those tools pass this project.",
  62. }
  63. def _assert_under(parent: Path, target: Path, label: str) -> Path:
  64. parent_resolved = parent.resolve()
  65. target_resolved = target.resolve()
  66. if target_resolved != parent_resolved and parent_resolved not in target_resolved.parents:
  67. raise ValueError(f"{label} must stay under {parent_resolved}: {target_resolved}")
  68. return target_resolved
  69. def _assert_safe_toolchain_root(path: Path) -> Path:
  70. resolved = path.resolve()
  71. home = Path.home().resolve()
  72. base = DEFAULT_TOOLCHAIN_BASE.resolve()
  73. _assert_under(base, resolved, "toolchain path")
  74. if resolved in {home, home.parent, Path(resolved.anchor)}:
  75. raise ValueError(f"unsafe toolchain root: {resolved}")
  76. return resolved
  77. def _write_owner_marker(root: Path, component: str, payload: dict[str, Any]) -> None:
  78. root.mkdir(parents=True, exist_ok=True)
  79. marker = {
  80. "schema": "cpld-toolchain-owner-v1",
  81. "component": component,
  82. "root": str(root),
  83. "safety": {
  84. "opens_com_ports": False,
  85. "toggles_dtr_rts": False,
  86. "installs_drivers": False,
  87. "programs_flash": False,
  88. "touches_real_board_io": False,
  89. },
  90. "payload": payload,
  91. }
  92. (root / OWNER_MARKER_NAME).write_text(json.dumps(marker, indent=2) + "\n", encoding="utf-8")
  93. def _write_install_manifest(root: Path, payload: dict[str, Any]) -> Path:
  94. manifest_path = root / INSTALL_MANIFEST_NAME
  95. manifest_path.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
  96. return manifest_path
  97. def _is_owned(root: Path, component: str | None = None) -> bool:
  98. marker = root / OWNER_MARKER_NAME
  99. if not marker.is_file():
  100. return False
  101. if component is None:
  102. return True
  103. try:
  104. payload = json.loads(marker.read_text(encoding="utf-8-sig"))
  105. except json.JSONDecodeError:
  106. return False
  107. return payload.get("component") == component
  108. def sha256(path: Path) -> str:
  109. digest = hashlib.sha256()
  110. with path.open("rb") as handle:
  111. for chunk in iter(lambda: handle.read(1024 * 1024), b""):
  112. digest.update(chunk)
  113. return digest.hexdigest()
  114. def powershell_literal(value: str | Path) -> str:
  115. return "'" + str(value).replace("'", "''") + "'"
  116. def fetch_latest_release() -> dict[str, Any]:
  117. request = urllib.request.Request(
  118. LATEST_API_URL,
  119. headers={"User-Agent": "prod2u-p4-actuator-trace-toolchain-bootstrap"},
  120. )
  121. with urllib.request.urlopen(request, timeout=30) as response:
  122. return json.loads(response.read().decode("utf-8"))
  123. def select_windows_x64_asset(release_payload: dict[str, Any]) -> dict[str, Any]:
  124. for asset in release_payload.get("assets", []):
  125. name = asset.get("name", "")
  126. if name.startswith("oss-cad-suite-windows-x64-") and name.endswith(".exe"):
  127. if asset.get("browser_download_url"):
  128. return asset
  129. raise ValueError("No oss-cad-suite-windows-x64-*.exe asset found in release payload")
  130. def download_file(url: str, output: Path) -> None:
  131. output.parent.mkdir(parents=True, exist_ok=True)
  132. curl = shutil.which("curl.exe") or shutil.which("curl")
  133. if curl:
  134. cmd = [
  135. curl,
  136. "-L",
  137. "--fail",
  138. "-C",
  139. "-",
  140. "--retry",
  141. "3",
  142. "--connect-timeout",
  143. "30",
  144. "--output",
  145. str(output),
  146. url,
  147. ]
  148. try:
  149. result = subprocess.run(cmd, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=7200)
  150. except subprocess.TimeoutExpired as exc:
  151. raise RuntimeError(f"curl download timed out; rerun the command to resume: {exc}") from exc
  152. if result.returncode != 0:
  153. detail = (result.stdout + result.stderr)[-2000:]
  154. raise RuntimeError(f"curl download failed with returncode {result.returncode}: {detail}")
  155. else:
  156. temp_output = output.with_suffix(output.suffix + ".part")
  157. if temp_output.exists():
  158. temp_output.unlink()
  159. request = urllib.request.Request(
  160. url,
  161. headers={"User-Agent": "prod2u-p4-actuator-trace-toolchain-bootstrap"},
  162. )
  163. with urllib.request.urlopen(request, timeout=60) as response, temp_output.open("wb") as handle:
  164. shutil.copyfileobj(response, handle)
  165. if not temp_output.is_file() or temp_output.stat().st_size == 0:
  166. raise RuntimeError(f"download produced empty file: {temp_output}")
  167. temp_output.replace(output)
  168. if not output.is_file() or output.stat().st_size == 0:
  169. raise RuntimeError(f"download produced empty file: {output}")
  170. def extract_archive(archive: Path, install_root: Path) -> None:
  171. install_root = _assert_safe_toolchain_root(install_root)
  172. install_root.parent.mkdir(parents=True, exist_ok=True)
  173. suffix = archive.suffix.lower()
  174. if suffix == ".zip":
  175. staging = install_root.with_name(install_root.name + ".staging")
  176. if staging.exists():
  177. if not _is_owned(staging, "oss_cad_suite_staging"):
  178. raise RuntimeError(f"refusing to replace unowned staging directory: {staging}")
  179. shutil.rmtree(staging)
  180. staging.mkdir(parents=True, exist_ok=True)
  181. _write_owner_marker(staging, "oss_cad_suite_staging", {"archive": str(archive)})
  182. with zipfile.ZipFile(archive) as zf:
  183. for member in zf.namelist():
  184. _assert_under(staging, staging / member, "zip member")
  185. zf.extractall(staging)
  186. if install_root.exists():
  187. if not _is_owned(install_root, "oss_cad_suite"):
  188. raise RuntimeError(f"refusing to replace unowned install root: {install_root}")
  189. shutil.rmtree(install_root)
  190. staging.rename(install_root)
  191. _write_owner_marker(install_root, "oss_cad_suite", {"archive": str(archive)})
  192. elif suffix == ".exe":
  193. if install_root.exists():
  194. if not _is_owned(install_root, "oss_cad_suite"):
  195. raise RuntimeError(f"refusing to replace unowned install root: {install_root}")
  196. shutil.rmtree(install_root)
  197. install_root.mkdir(parents=True, exist_ok=True)
  198. _write_owner_marker(install_root, "oss_cad_suite", {"archive": str(archive), "extractor": "sfx"})
  199. commands = [
  200. [str(archive), "-y", f"-o{install_root}"],
  201. [str(archive), "/S", f"/D={install_root}"],
  202. ]
  203. last_result: subprocess.CompletedProcess[str] | None = None
  204. for cmd in commands:
  205. try:
  206. last_result = subprocess.run(cmd, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=300)
  207. except (OSError, subprocess.TimeoutExpired):
  208. continue
  209. if (install_root / "bin").is_dir() or (install_root / "oss-cad-suite" / "bin").is_dir():
  210. break
  211. _promote_nested_install_root(install_root)
  212. if not (install_root / "bin").is_dir():
  213. detail = "" if last_result is None else (last_result.stdout + last_result.stderr)[-2000:]
  214. raise RuntimeError(f"OSS CAD Suite SFX extraction did not create bin directory: {detail}")
  215. else:
  216. raise ValueError(f"Unsupported archive type: {archive}")
  217. _promote_nested_install_root(install_root)
  218. def _promote_nested_install_root(install_root: Path) -> None:
  219. nested = install_root / "oss-cad-suite"
  220. if not (nested / "bin").is_dir():
  221. return
  222. temp_root = install_root.with_name(install_root.name + ".nested")
  223. if temp_root.exists():
  224. shutil.rmtree(temp_root)
  225. nested.rename(temp_root)
  226. for child in list(install_root.iterdir()):
  227. if child == temp_root:
  228. continue
  229. if child.is_dir():
  230. shutil.rmtree(child)
  231. else:
  232. child.unlink()
  233. for child in temp_root.iterdir():
  234. child.rename(install_root / child.name)
  235. temp_root.rmdir()
  236. def install_latest_windows_x64(
  237. *,
  238. install_root: Path,
  239. download_dir: Path,
  240. release_payload: dict[str, Any] | None = None,
  241. download_func=download_file,
  242. extract_func=extract_archive,
  243. ) -> dict[str, Any]:
  244. release = release_payload or fetch_latest_release()
  245. install_root = _assert_safe_toolchain_root(install_root)
  246. asset = select_windows_x64_asset(release)
  247. archive = download_dir / asset["name"]
  248. download_func(asset["browser_download_url"], archive)
  249. archive_hash = sha256(archive)
  250. extract_func(archive, install_root)
  251. payload = tool_status(install_root)
  252. payload.update({
  253. "status": "present" if all(item["status"] == "present" for item in payload["tools"].values()) else "fail",
  254. "release_tag": release.get("tag_name"),
  255. "asset": {
  256. "name": asset.get("name"),
  257. "browser_download_url": asset.get("browser_download_url"),
  258. "size": asset.get("size"),
  259. },
  260. "archive": str(archive),
  261. "sha256": archive_hash,
  262. "manifest": str(install_root / INSTALL_MANIFEST_NAME),
  263. "safety": {
  264. "opens_com_ports": False,
  265. "toggles_dtr_rts": False,
  266. "installs_drivers": False,
  267. "programs_flash": False,
  268. "touches_real_board_io": False,
  269. },
  270. })
  271. _write_owner_marker(install_root, "oss_cad_suite", payload)
  272. _write_install_manifest(install_root, payload)
  273. report_path = install_root / "toolchain-install-report.json"
  274. report_path.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
  275. if payload["status"] != "present":
  276. missing = [name for name, info in payload["tools"].items() if info["status"] != "present"]
  277. raise RuntimeError("OSS CAD Suite install missing required tools: " + ", ".join(missing))
  278. return payload
  279. def run_checked(cmd: list[str], *, cwd: Path | None = None, timeout: int = 600) -> subprocess.CompletedProcess[str]:
  280. result = subprocess.run(
  281. cmd,
  282. cwd=cwd,
  283. text=True,
  284. stdout=subprocess.PIPE,
  285. stderr=subprocess.PIPE,
  286. timeout=timeout,
  287. )
  288. if result.returncode != 0:
  289. detail = (result.stdout + result.stderr)[-3000:]
  290. raise RuntimeError(f"command failed with returncode {result.returncode}: {' '.join(cmd)}\n{detail}")
  291. return result
  292. def uninstall_owned_toolchain(
  293. *,
  294. install_root: Path = DEFAULT_ROOT,
  295. cocotb_venv: Path = DEFAULT_COCOTB_VENV,
  296. dry_run: bool = True,
  297. include_downloads: bool = False,
  298. download_dir: Path = DEFAULT_DOWNLOAD_DIR,
  299. ) -> dict[str, Any]:
  300. targets = [install_root, cocotb_venv]
  301. if include_downloads:
  302. targets.append(download_dir)
  303. actions: list[dict[str, Any]] = []
  304. status = "pass"
  305. for target in targets:
  306. exists = target.exists()
  307. owned = target.is_dir() and _is_owned(target)
  308. item: dict[str, Any] = {
  309. "path": str(target),
  310. "exists": exists,
  311. "owned": owned,
  312. "action": "not_present",
  313. }
  314. if exists and not owned:
  315. item["action"] = "blocked_not_owned"
  316. status = "blocked_not_owned"
  317. elif exists and owned and dry_run:
  318. item["action"] = "would_delete"
  319. elif exists and owned:
  320. shutil.rmtree(target)
  321. item["action"] = "deleted"
  322. actions.append(item)
  323. return {
  324. "schema": "offline-toolchain-uninstall-v1",
  325. "status": status,
  326. "mode": "dry_run" if dry_run else "apply",
  327. "targets": actions,
  328. "cleanup_policy": {
  329. "default": "dry_run",
  330. "requires_owner_marker": True,
  331. "owner_marker_name": OWNER_MARKER_NAME,
  332. "actual_delete_requires_apply": True,
  333. },
  334. "safety": {
  335. "opens_com_ports": False,
  336. "toggles_dtr_rts": False,
  337. "installs_drivers": False,
  338. "programs_flash": False,
  339. "touches_real_board_io": False,
  340. },
  341. "authority_boundary": "Uninstall only removes marker-owned user-mode toolchain paths and never probes serial ports, installs drivers, programs flash, or touches real hardware.",
  342. }
  343. def install_cocotb_venv(
  344. *,
  345. venv_dir: Path,
  346. python_exe: Path,
  347. cocotb_version: str = DEFAULT_COCOTB_VERSION,
  348. extra_packages: list[str] | None = None,
  349. ) -> dict[str, Any]:
  350. if not python_exe.is_file():
  351. raise FileNotFoundError(f"Python executable not found: {python_exe}")
  352. venv_dir = _assert_safe_toolchain_root(venv_dir)
  353. venv_python = venv_dir / "Scripts" / "python.exe"
  354. if not venv_python.is_file():
  355. run_checked([str(python_exe), "-m", "venv", str(venv_dir)])
  356. if not venv_python.is_file():
  357. raise RuntimeError(f"venv creation did not create Python executable: {venv_python}")
  358. run_checked([str(venv_python), "-m", "pip", "install", "--upgrade", "pip"], timeout=1200)
  359. packages = [f"cocotb=={cocotb_version}"] + list(extra_packages if extra_packages is not None else DEFAULT_EXTRA_PYTHON_PACKAGES)
  360. run_checked([str(venv_python), "-m", "pip", "install", *packages], timeout=1200)
  361. verify = run_checked([str(venv_python), "-c", "import cocotb; print(cocotb.__version__)"])
  362. detected_version = verify.stdout.strip().splitlines()[-1] if verify.stdout.strip() else None
  363. payload = {
  364. "schema": "prod2u-p4-actuator-trace-cocotb-venv-bootstrap-v1",
  365. "status": "present" if detected_version == cocotb_version else "fail",
  366. "venv_dir": str(venv_dir),
  367. "python": str(venv_python),
  368. "source_python": str(python_exe),
  369. "cocotb_version": detected_version,
  370. "requested_cocotb_version": cocotb_version,
  371. "extra_packages": list(extra_packages if extra_packages is not None else DEFAULT_EXTRA_PYTHON_PACKAGES),
  372. "manifest": str(venv_dir / INSTALL_MANIFEST_NAME),
  373. "safety": {
  374. "opens_com_ports": False,
  375. "toggles_dtr_rts": False,
  376. "installs_drivers": False,
  377. "programs_flash": False,
  378. "touches_real_board_io": False,
  379. },
  380. "authority_boundary": "This helper only creates a local Python venv and installs cocotb; it does not prove cocotb tests pass this project.",
  381. }
  382. _write_owner_marker(venv_dir, "cocotb_venv", payload)
  383. _write_install_manifest(venv_dir, payload)
  384. report_path = venv_dir / "cocotb-venv-install-report.json"
  385. report_path.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
  386. if payload["status"] != "present":
  387. raise RuntimeError(f"cocotb version verification failed: expected {cocotb_version}, got {detected_version}")
  388. return payload
  389. def build_parser() -> argparse.ArgumentParser:
  390. parser = argparse.ArgumentParser(description=__doc__)
  391. parser.add_argument("--install-root", type=Path, default=DEFAULT_ROOT)
  392. parser.add_argument("--download-dir", type=Path, default=DEFAULT_DOWNLOAD_DIR)
  393. parser.add_argument("--cocotb-venv", type=Path, default=DEFAULT_COCOTB_VENV)
  394. parser.add_argument("--python-exe", type=Path, default=DEFAULT_BUNDLED_PYTHON)
  395. parser.add_argument("--cocotb-version", default=DEFAULT_COCOTB_VERSION)
  396. parser.add_argument("--install-latest-windows-x64", action="store_true")
  397. parser.add_argument("--install-cocotb-venv", action="store_true")
  398. parser.add_argument("--download-url", help="Explicit OSS CAD Suite zip URL. See releases URL in --json output.")
  399. parser.add_argument("--download-to", type=Path, help="Destination zip path for --download-url.")
  400. parser.add_argument("--extract-zip", type=Path, help="Extract a previously downloaded OSS CAD Suite zip.")
  401. parser.add_argument("--print-env", action="store_true", help="Print PowerShell environment commands.")
  402. parser.add_argument("--json", action="store_true")
  403. return parser
  404. def main(argv: list[str] | None = None) -> int:
  405. args = build_parser().parse_args(argv)
  406. if args.download_url:
  407. if not args.download_to:
  408. raise SystemExit("--download-to is required with --download-url")
  409. download_file(args.download_url, args.download_to)
  410. if args.install_latest_windows_x64:
  411. payload = install_latest_windows_x64(install_root=args.install_root, download_dir=args.download_dir)
  412. print(json.dumps(payload, indent=2) if args.json else f"installed: {payload['install_root']}")
  413. return 0
  414. if args.install_cocotb_venv:
  415. payload = install_cocotb_venv(
  416. venv_dir=args.cocotb_venv,
  417. python_exe=args.python_exe,
  418. cocotb_version=args.cocotb_version,
  419. )
  420. print(json.dumps(payload, indent=2) if args.json else f"installed: {payload['venv_dir']}")
  421. return 0
  422. if args.extract_zip:
  423. extract_archive(args.extract_zip, args.install_root)
  424. payload = tool_status(args.install_root)
  425. if args.print_env:
  426. native_verilator = payload["tools"]["verilator"]["path"]
  427. if not isinstance(native_verilator, str) or not native_verilator:
  428. raise SystemExit(
  429. "native Verilator executable is missing; refusing to expose the extensionless wrapper"
  430. )
  431. if not VERILATOR_SHIM.is_file():
  432. raise SystemExit(
  433. f"native Verilator command shim is missing: {VERILATOR_SHIM}"
  434. )
  435. if not ACTIVATION_SCRIPT.is_file():
  436. raise SystemExit(
  437. f"verification toolchain activation script is missing: {ACTIVATION_SCRIPT}"
  438. )
  439. lib_dir = args.install_root / "lib"
  440. if not lib_dir.is_dir():
  441. raise SystemExit(
  442. "native Verilator lib directory is missing; refusing to expose the toolchain bin directory"
  443. )
  444. verilator_root = args.install_root / "share" / "verilator"
  445. if not verilator_root.is_dir():
  446. raise SystemExit(
  447. "native Verilator share directory is missing; refusing to expose the toolchain bin directory"
  448. )
  449. smtbmc = next(
  450. (
  451. candidate
  452. for candidate in (
  453. args.install_root / "bin" / "yosys-smtbmc.exe.exe",
  454. args.install_root / "bin" / "yosys-smtbmc.exe",
  455. args.install_root / "bin" / "yosys-smtbmc",
  456. )
  457. if candidate.is_file()
  458. ),
  459. None,
  460. )
  461. if smtbmc is None:
  462. raise SystemExit(
  463. "SMTBMC executable is missing; refusing to expose an incomplete formal toolchain"
  464. )
  465. print(
  466. f"& {powershell_literal(ACTIVATION_SCRIPT)} "
  467. f"-ToolchainRoot {powershell_literal(args.install_root.resolve())}"
  468. )
  469. return 0
  470. if args.json:
  471. print(json.dumps(payload, indent=2))
  472. else:
  473. print(f"install_root: {payload['install_root']}")
  474. print(f"releases: {payload['releases_url']}")
  475. for name, status in payload["tools"].items():
  476. print(f"{name}: {status['status']} {status['path'] or ''}")
  477. return 0
  478. if __name__ == "__main__":
  479. raise SystemExit(main())