Get zccache version string for cache invalidation. When the zccache version changes, cached compilation artifacts may be incompatible and require a full rebuild. Args: zccache_path: Path to zccache binary. If None, auto-detected. Returns: Version string (e.g.,
(zccache_path: Optional[str] = None)
| 258 | |
| 259 | |
| 260 | def get_zccache_version(zccache_path: Optional[str] = None) -> str: |
| 261 | """ |
| 262 | Get zccache version string for cache invalidation. |
| 263 | |
| 264 | When the zccache version changes, cached compilation artifacts may be |
| 265 | incompatible and require a full rebuild. |
| 266 | |
| 267 | Args: |
| 268 | zccache_path: Path to zccache binary. If None, auto-detected. |
| 269 | |
| 270 | Returns: |
| 271 | Version string (e.g., "zccache 1.0.3") or "" if not available. |
| 272 | """ |
| 273 | if zccache_path is None: |
| 274 | zccache_path = _find_zccache_binary() |
| 275 | if not zccache_path: |
| 276 | return "" |
| 277 | try: |
| 278 | result = subprocess.run( |
| 279 | [zccache_path, "--version"], |
| 280 | capture_output=True, |
| 281 | text=True, |
| 282 | encoding="utf-8", |
| 283 | errors="replace", |
| 284 | timeout=10, |
| 285 | ) |
| 286 | if result.returncode == 0: |
| 287 | return result.stdout.strip() |
| 288 | return "" |
| 289 | except KeyboardInterrupt as ki: |
| 290 | handle_keyboard_interrupt(ki) |
| 291 | raise |
| 292 | except Exception: |
| 293 | return "" |
| 294 | |
| 295 | |
| 296 | def _resolve_fast_native_entries() -> FastNativeEntries: |
no test coverage detected