nerftools 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nerftools/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ """nerftools: build and manage nerf tools."""
2
+
3
+ from importlib.resources import files
4
+ from pathlib import Path
5
+
6
+ # Default manifests ship as a subpackage, accessible via importlib.resources
7
+ # for both editable installs and published wheels.
8
+ BUILTIN_MANIFESTS_DIR = Path(str(files("nerftools.default_manifests")))
9
+
10
+ _NERFCTL_DIR = Path(__file__).parent / "nerfctl" / "claude"
11
+
12
+ NERFCTL_SCRIPTS: dict[str, Path] = {
13
+ "nerfctl-grant-allow": _NERFCTL_DIR / "grant-allow.sh",
14
+ "nerfctl-grant-deny": _NERFCTL_DIR / "grant-deny.sh",
15
+ "nerfctl-grant-reset": _NERFCTL_DIR / "grant-reset.sh",
16
+ "nerfctl-grant-by-threat": _NERFCTL_DIR / "grant-by-threat.sh",
17
+ "nerfctl-grant-list": _NERFCTL_DIR / "grant-list.sh",
18
+ "nerfctl-install-plugin": _NERFCTL_DIR / "install-plugin.sh",
19
+ }
20
+
21
+
22
+ def install_nerfctl(output: Path) -> list[Path]:
23
+ """Copy nerfctl scripts into *output*. Returns paths written."""
24
+ output.mkdir(parents=True, exist_ok=True)
25
+ written: list[Path] = []
26
+ for name, src in NERFCTL_SCRIPTS.items():
27
+ if not src.exists():
28
+ msg = f"nerfctl script not found: {src}"
29
+ raise FileNotFoundError(msg)
30
+ dest = output / name
31
+ # Read as text to normalize CRLF -> LF (Windows checkout), then
32
+ # write as raw UTF-8 bytes to guarantee Unix line endings.
33
+ dest.write_bytes(src.read_text(encoding="utf-8").encode("utf-8"))
34
+ dest.chmod(0o755)
35
+ written.append(dest)
36
+ return written