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

Function get_compiler_version

ci/meson/compiler.py:158–188  ·  view source on GitHub ↗

Get compiler version string for cache invalidation. This function queries the compiler's version to detect when the compiler has been upgraded, which requires invalidating cached PCH and object files. Args: compiler_path: Path to compiler executable (e.g., clang-tool-chain

(compiler_path: str)

Source from the content-addressed store, hash-verified

156
157
158def get_compiler_version(compiler_path: str) -> str:
159 """
160 Get compiler version string for cache invalidation.
161
162 This function queries the compiler's version to detect when the compiler
163 has been upgraded, which requires invalidating cached PCH and object files.
164
165 Args:
166 compiler_path: Path to compiler executable (e.g., clang-tool-chain-cpp)
167
168 Returns:
169 Version string (e.g., "clang version 21.1.5") or "unknown" on error
170 """
171 try:
172 result = subprocess.run(
173 [compiler_path, "--version"],
174 capture_output=True,
175 text=True,
176 encoding="utf-8",
177 errors="replace",
178 check=True,
179 timeout=30, # Increased from 10s for first-time clang toolchain download
180 )
181 # Return first line which contains version info
182 return result.stdout.split("\n")[0].strip()
183 except KeyboardInterrupt as ki:
184 handle_keyboard_interrupt(ki)
185 raise
186 except Exception as e:
187 _ts_print(f"[MESON] Warning: Could not get compiler version: {e}")
188 return "unknown"

Callers 1

Calls 2

runMethod · 0.45

Tested by

no test coverage detected