footprint_writes.py
python
sha256:c079680aa72b38cf20f7891daeadbb28f6ec71301dff7c1973565401e6f23a34
docs: align public documentation and website with bounded v1
Human
minor
⚠ breaking
8 days 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:c079680aa72b38cf20f7891daeadbb28f6ec71301dff7c1973565401e6f23a34
docs: align public documentation and website with bounded v1
Human
minor
⚠
8 days ago