mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
18 lines
527 B
Python
18 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)
|