Files
ai-engineering/scripts/native-package-manifest.py
T

13 lines
528 B
Python

#!/usr/bin/env python3
import hashlib
import json
from pathlib import Path
import sys
package = Path(sys.argv[1]).resolve()
files = {str(path.relative_to(package)): hashlib.sha256(path.read_bytes()).hexdigest()
for path in sorted(package.rglob("*")) if path.is_file() and path.name != "aie-package.json"}
manifest = {"schemaVersion": 1, "aieVersion": "0.1.0", "protocolVersion": 4,
"sqliteVersion": "3.54.1", "files": files}
(package / "aie-package.json").write_text(json.dumps(manifest, indent=2) + "\n")