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

Function _resolve_fast_native_entries

ci/meson/native_launchers.py:296–355  ·  view source on GitHub ↗

Resolve native launcher binaries for the Meson native file. Uses ctc-clang/ctc-clang++ native launchers which handle all platform- specific flags automatically (--target, --sysroot, -stdlib, includes, etc.) with near-zero startup overhead (~34ms vs ~1200ms for Python wrappers).

()

Source from the content-addressed store, hash-verified

294
295
296def _resolve_fast_native_entries() -> FastNativeEntries:
297 """
298 Resolve native launcher binaries for the Meson native file.
299
300 Uses ctc-clang/ctc-clang++ native launchers which handle all platform-
301 specific flags automatically (--target, --sysroot, -stdlib, includes, etc.)
302 with near-zero startup overhead (~34ms vs ~1200ms for Python wrappers).
303
304 Note: zccache wrapping is intentionally NOT applied here. The meson
305 configure phase runs probes like ``<cc> -xc++ -E -v -`` to scan the
306 compiler&#x27;s include search paths and capabilities. zccache (and other
307 full-path compiler caches that meson does not recognise — see
308 ``mesonbuild/envconfig.py:BinaryTable.parse_entry`` which only strips
309 the literal strings ``'ccache'`` / ``'sccache'``) wraps those probes
310 and causes them to hang or return non-parseable output, leading to
311 "No include directory found" warnings followed by failing capability
312 probes. Instead, zccache is applied as a post-patch on the generated
313 ``build.ninja`` via ``inject_zccache_wrapping`` — probes run against
314 the bare compiler, build runs through zccache as before. See issue
315 #2714.
316
317 Returns:
318 FastNativeEntries with cc, cxx, and ar entries for the native file,
319 or all-None fields if resolution fails (falls back to wrappers).
320 """
321 _none = FastNativeEntries(cc=None, cxx=None, ar=None)
322 try:
323 from clang_tool_chain.platform.paths import (
324 find_tool_binary,
325 )
326 except ImportError:
327 return _none
328
329 try:
330 ar_path = str(find_tool_binary("llvm-ar"))
331
332 project_root = Path(__file__).resolve().parent.parent.parent
333 ctc_c, ctc_cpp = _ensure_native_launcher(project_root)
334 if ctc_c is None or ctc_cpp is None:
335 return _none
336
337 # Escape any single quotes in the path so the generated Meson
338 # list-of-strings remains valid even if a path happens to contain
339 # one. Paths under ``.cached/clang-native/`` are extremely unlikely
340 # to contain ``'`` in practice, but defensive escaping costs nothing
341 # and avoids a hard-to-debug native-file parse error.
342 def _q(p: str) -> str:
343 return p.replace("'", "\\'")
344
345 return FastNativeEntries(
346 cc=f"['{_q(ctc_c)}']",
347 cxx=f"['{_q(ctc_cpp)}']",
348 ar=f"['{_q(ar_path)}']",
349 )
350
351 except KeyboardInterrupt as ki:
352 handle_keyboard_interrupt(ki)
353 return _none # unreachable, satisfies type checker

Callers 1

write_meson_native_fileFunction · 0.90

Calls 5

FastNativeEntriesClass · 0.85
_ensure_native_launcherFunction · 0.85
_qFunction · 0.85
resolveMethod · 0.45

Tested by

no test coverage detected