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

Function main

ci/check_backend_flag_drift.py:489–629  ·  view source on GitHub ↗
(argv: list[str] | None = None)

Source from the content-addressed store, hash-verified

487
488
489def main(argv: list[str] | None = None) -> int:
490 parser = argparse.ArgumentParser(
491 description=(
492 "Detect compiler-flag drift between the fbuild and PlatformIO "
493 "backends for a single board. Exits non-zero on drift."
494 )
495 )
496 parser.add_argument(
497 "--board",
498 required=True,
499 help="Board to check (e.g. teensy41, esp32dev).",
500 )
501 parser.add_argument(
502 "--example",
503 default="Blink",
504 help="Sketch to compile in each backend (default: Blink).",
505 )
506 parser.add_argument(
507 "--skip-build",
508 action="store_true",
509 help=(
510 "Skip the actual compiles and reuse any existing "
511 "build_info_*.json files. Fails if neither backend has produced "
512 "one yet."
513 ),
514 )
515 parser.add_argument(
516 "--timeout",
517 type=int,
518 default=900,
519 help="Per-backend compile timeout in seconds (default: 900).",
520 )
521 parser.add_argument(
522 "--project-root",
523 type=Path,
524 default=None,
525 help="Override the FastLED repo root (default: auto-detect).",
526 )
527 args = parser.parse_args(argv)
528
529 project_root = (
530 args.project_root.resolve()
531 if args.project_root is not None
532 else Path(__file__).resolve().parent.parent
533 )
534
535 # The two backends overwrite the same .build/pio/<board>/build_info_*.json
536 # file, so we must snapshot fbuild's output BEFORE running pio. The
537 # --skip-build path only works when the user has already manually staged
538 # both backends' build_info JSONs (or saved one elsewhere); we don't have
539 # a way to recover a fresh fbuild snapshot from disk after pio has run.
540
541 fbuild_info: dict
542 pio_info: dict
543
544 if args.skip_build:
545 bi_path = _find_build_info(project_root, args.board, args.example, "fbuild")
546 if bi_path is None:

Callers 1

Calls 10

_run_compileFunction · 0.85
normalize_build_infoFunction · 0.85
compute_driftFunction · 0.85
render_reportFunction · 0.85
parse_argsMethod · 0.80
has_driftMethod · 0.80
_find_build_infoFunction · 0.70
printFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected