MCPcopy Create free account
hub / github.com/FastLED/FastLED / _find_zccache_binary

Function _find_zccache_binary

ci/meson/native_launchers.py:196–257  ·  view source on GitHub ↗

Find the zccache binary for compiler caching. zccache is a blazing-fast local compiler cache daemon (43x faster than other caches on warm hits). It works as a drop-in compiler launcher prefix. Search order: 1. Sibling zccache repo (../zccache/target/{release,debug}) — dev buil

()

Source from the content-addressed store, hash-verified

194
195
196def _find_zccache_binary() -> Optional[str]:
197 """
198 Find the zccache binary for compiler caching.
199
200 zccache is a blazing-fast local compiler cache daemon (43x faster than
201 other caches on warm hits). It works as a drop-in compiler launcher prefix.
202
203 Search order:
204 1. Sibling zccache repo (../zccache/target/{release,debug}) — dev builds
205 2. PATH (via shutil.which)
206 3. Common cargo install locations
207
208 Returns:
209 Path to zccache binary, or None if not found.
210 """
211 suffix = (
212 ".exe"
213 if os.name == "nt" or sys.platform.startswith(("win", "msys", "cygwin"))
214 else ""
215 )
216
217 # Check project .venv first (installed release version)
218 repo_root = Path(__file__).resolve().parent.parent.parent # ci/meson/ -> repo root
219 venv_candidate = (
220 repo_root
221 / ".venv"
222 / ("Scripts" if os.name == "nt" else "bin")
223 / f"zccache{suffix}"
224 )
225 if venv_candidate.is_file():
226 return str(venv_candidate)
227
228 # Check sibling zccache repo (pick most recently built binary)
229 sibling_zccache = repo_root.parent / "zccache"
230 best: Optional[Path] = None
231 best_mtime: float = 0
232 for profile in ("release", "debug"):
233 candidate = sibling_zccache / "target" / profile / f"zccache{suffix}"
234 if candidate.is_file():
235 mtime = candidate.stat().st_mtime
236 if mtime > best_mtime:
237 best = candidate
238 best_mtime = mtime
239 if best is not None:
240 return str(best)
241
242 # Check PATH
243 path_result = shutil.which("zccache")
244 if path_result:
245 return path_result
246
247 # Check common cargo bin locations
248 for candidate_home in [
249 os.environ.get("CARGO_HOME", ""),
250 os.path.join(os.path.expanduser("~"), ".cargo"),
251 ]:
252 if candidate_home:
253 candidate_path = os.path.join(candidate_home, "bin", f"zccache{suffix}")

Callers 3

_start_zccache_sessionFunction · 0.90
get_zccache_versionFunction · 0.85

Calls 2

resolveMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected