footprint_writes.py python
21 lines 723 B
Raw
sha256:c07f2f34a0db9f43fe866f157d1935322008545ff8940c06c7c921eb219c55ab NXP-b DONE: independent BV-r2 pass + ISR (SD-17) Human minor ⚠ breaking 18 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 1 commit
sha256:c07f2f34a0db9f43fe866f157d1935322008545ff8940c06c7c921eb219c55ab NXP-b DONE: independent BV-r2 pass + ISR (SD-17) Human minor 18 hours ago