footprint_writes.py python
21 lines 723 B
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 9 hours ago
1 """Footprint file writes with regime-specific modes (§K7.3.1 executable script)."""
2
3 from __future__ import annotations
4
5 import os
6 from pathlib import Path
7
8 from cli.atomic import WriteFailure, atomic_write_bytes
9 from cli.footprint import EXECUTABLE_FOOTPRINT_DESTINATIONS
10
11 FOOTPRINT_EXECUTABLE_MODE = 0o755
12
13
14 def write_footprint_bytes(path: Path, data: bytes, *, destination: str) -> None:
15 """Atomically write one footprint file; set mode ``0755`` for executable destinations."""
16 atomic_write_bytes(path, data)
17 if destination in EXECUTABLE_FOOTPRINT_DESTINATIONS:
18 try:
19 path.chmod(FOOTPRINT_EXECUTABLE_MODE)
20 except OSError as exc:
21 raise WriteFailure(path, exc) from exc
File History 2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 9 hours ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 52 days ago