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

Function validate_and_detect_manifest

ci/compiler/platformio_cache.py:508–542  ·  view source on GitHub ↗

Validate manifest files and auto-detect artifact type.

(
    content_path: Path,
)

Source from the content-addressed store, hash-verified

506
507
508def validate_and_detect_manifest(
509 content_path: Path,
510) -> ManifestResult:
511 """
512 Validate manifest files and auto-detect artifact type.
513 """
514 # Try framework manifests first
515 framework_manifests = ["framework.json", "package.json"]
516 for manifest in framework_manifests:
517 manifest_path = content_path / manifest
518 if manifest_path.exists():
519 try:
520 with open(manifest_path, "r") as f:
521 json.load(f) # Validate JSON syntax
522 print(f"Found valid framework manifest: {manifest_path}")
523 return ManifestResult(
524 is_valid=True, manifest_path=manifest_path, is_framework=True
525 )
526 except json.JSONDecodeError as e:
527 logger.warning(f"Invalid JSON in {manifest_path}: {e}")
528
529 # Try platform manifest
530 platform_manifest = content_path / "platform.json"
531 if platform_manifest.exists():
532 try:
533 with open(platform_manifest, "r") as f:
534 json.load(f) # Validate JSON syntax
535 print(f"Found valid platform manifest: {platform_manifest}")
536 return ManifestResult(
537 is_valid=True, manifest_path=platform_manifest, is_framework=False
538 )
539 except json.JSONDecodeError as e:
540 logger.warning(f"Invalid JSON in {platform_manifest}: {e}")
541
542 return ManifestResult(is_valid=False, manifest_path=None, is_framework=False)
543
544
545def get_platformio_command_path(path: Path) -> str:

Callers 2

unzip_and_installFunction · 0.85
handle_zip_artifactFunction · 0.85

Calls 4

ManifestResultClass · 0.85
warningMethod · 0.80
printFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected