TRX/tools/shared/packaging.py
2024-10-03 10:36:35 +02:00

17 lines
527 B
Python

import sys
import zipfile
from collections.abc import Iterable
from pathlib import Path
def create_zip(
output_path: Path, source_files: Iterable[tuple[Path, str]]
) -> None:
with zipfile.ZipFile(output_path, "w") as handle:
for source_path, archive_name in source_files:
if not source_path.exists():
print(
f"WARNING: {source_path} does not exist", file=sys.stderr
)
continue
handle.write(source_path, archive_name)