Files
pigway-frame-flow/scripts/package-nas.py
T

19 lines
624 B
Python
Raw Permalink Normal View History

"""Package only tracked project files; never include .env, data, .git or caches."""
import subprocess
import tarfile
from pathlib import Path
root = Path(__file__).resolve().parents[1]
output = root / "dist/pigway-frame-flow-nas.tar.gz"
output.parent.mkdir(exist_ok=True)
files = (
subprocess.check_output(["git", "ls-files", "-z"], cwd=root).decode().split("\0")
)
with tarfile.open(output, "w:gz") as archive:
for file in files:
if not file or file == ".env" or file.startswith(("data/", ".git/")):
continue
archive.add(root / file, arcname="pigway-frame-flow/" + file)
print(output)