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

Function _fbuild_supports_subcommand

ci/util/fbuild_runner.py:178–209  ·  view source on GitHub ↗

Return whether the active fbuild executable exposes ``subcommand``. Probes with `` --help`` rather than `` help ``: the latter parses ``help`` as the subcommand name and `` `` as a positional arg, which fails clap arg validation (e

(subcommand: str)

Source from the content-addressed store, hash-verified

176
177
178def _fbuild_supports_subcommand(subcommand: str) -> bool:
179 """Return whether the active fbuild executable exposes ``subcommand``.
180
181 Probes with ``<fbuild> <subcommand> --help`` rather than ``<fbuild> help
182 <subcommand>``: the latter parses ``help`` as the subcommand name and
183 ``<subcommand>`` as a positional arg, which fails clap arg validation
184 (exit 2) on any subcommand with required args like ``--board``. With
185 ``--help`` clap intercepts and prints help with exit 0 regardless of
186 other required args. The old probe silently disabled compile-many on
187 every CI run and forced the legacy serial fallback path.
188 """
189 import subprocess
190
191 fbuild_exe = get_fbuild_executable()
192 if fbuild_exe is None:
193 return False
194 try:
195 proc = subprocess.run(
196 [fbuild_exe, subcommand, "--help"],
197 capture_output=True,
198 text=True,
199 timeout=15,
200 check=False,
201 )
202 except KeyboardInterrupt as ki:
203 from ci.util.global_interrupt_handler import handle_keyboard_interrupt
204
205 handle_keyboard_interrupt(ki)
206 raise
207 except (FileNotFoundError, subprocess.SubprocessError, OSError):
208 return False
209 return proc.returncode == 0
210
211
212@lru_cache(maxsize=1)

Callers 2

fbuild_supports_ciFunction · 0.85

Calls 3

get_fbuild_executableFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected