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

Function save_cache

ci/meson/src_metadata_cache.py:117–139  ·  view source on GitHub ↗

Save source metadata to cache file. Args: build_dir: Meson build directory src_hash: Hash of source file metadata metadata: Source metadata output from discovery script

(build_dir: Path, src_hash: str, metadata: str)

Source from the content-addressed store, hash-verified

115
116
117def save_cache(build_dir: Path, src_hash: str, metadata: str) -> None:
118 """
119 Save source metadata to cache file.
120
121 Args:
122 build_dir: Meson build directory
123 src_hash: Hash of source file metadata
124 metadata: Source metadata output from discovery script
125 """
126 import time
127
128 cache_file = build_dir / CACHE_FILENAME
129 build_dir.mkdir(parents=True, exist_ok=True)
130
131 cache = {
132 "version": CACHE_VERSION,
133 "hash": src_hash,
134 "timestamp": time.time(),
135 "metadata": metadata,
136 }
137
138 with open(cache_file, "w", encoding="utf-8") as f:
139 json.dump(cache, f, indent=2)
140
141
142def main(argv: list[str] | None = None) -> None:

Callers 1

mainFunction · 0.70

Calls 2

timeMethod · 0.80
dumpMethod · 0.45

Tested by

no test coverage detected