Identify the mandoc binary that produced an extraction. Returns one of: ``repo: `` tracked tools/mandoc-md, clean working tree. ``repo:dirty: `` tools/mandoc-md but modified vs HEAD. ``custom: `` any other binary (system mandoc, en
(binary_path: str)
| 103 | |
| 104 | |
| 105 | def resolve_mandoc_version(binary_path: str) -> str | None: |
| 106 | """Identify the mandoc binary that produced an extraction. |
| 107 | |
| 108 | Returns one of: |
| 109 | ``repo:<short-sha>`` tracked tools/mandoc-md, clean working tree. |
| 110 | ``repo:dirty:<sha256-pfx>`` tools/mandoc-md but modified vs HEAD. |
| 111 | ``custom:<sha256-pfx>`` any other binary (system mandoc, env override). |
| 112 | ``None`` binary cannot be located. |
| 113 | """ |
| 114 | located = shutil.which(binary_path) or binary_path |
| 115 | try: |
| 116 | abs_path = str(Path(located).resolve(strict=True)) |
| 117 | except (OSError, RuntimeError): |
| 118 | return None |
| 119 | st = os.stat(abs_path) |
| 120 | return _resolve_mandoc_version_cached(abs_path, (st.st_mtime, st.st_size)) |
no test coverage detected