Fingerprint only sources that can affect generated JS glue.
()
| 213 | |
| 214 | |
| 215 | def _compute_js_glue_fingerprint() -> str: |
| 216 | """Fingerprint only sources that can affect generated JS glue.""" |
| 217 | global _cached_js_fingerprint, _cached_js_fingerprint_time |
| 218 | now = time.monotonic() |
| 219 | if _cached_js_fingerprint is not None and (now - _cached_js_fingerprint_time) < 0.5: |
| 220 | return _cached_js_fingerprint |
| 221 | |
| 222 | digest = hashlib.md5(usedforsecurity=False) |
| 223 | for path in _iter_js_affecting_files(): |
| 224 | try: |
| 225 | st = path.stat() |
| 226 | digest.update(f"{path}:{st.st_mtime:.6f}:{st.st_size}".encode()) |
| 227 | except OSError: |
| 228 | digest.update(f"{path}:MISSING".encode()) |
| 229 | |
| 230 | _cached_js_fingerprint = digest.hexdigest() |
| 231 | _cached_js_fingerprint_time = now |
| 232 | return _cached_js_fingerprint |
| 233 | |
| 234 | |
| 235 | def _clear_link_cache(build_dir: Path) -> None: |
no test coverage detected