doc: add docstring and do some refactor

This commit is contained in:
2026-08-05 15:53:52 +08:00
parent 816e3a59d0
commit 520bfc2054
7 changed files with 264 additions and 21 deletions
@@ -1,3 +1,9 @@
"""Dual-sink archiver that materializes a distribution tree.
The :class:`Archiver` mirrors the same logical entries into an on-disk
directory and/or a zip archive, and is usable as a context manager.
"""
import zipfile
import shutil
from pathlib import Path
@@ -43,6 +49,11 @@ class Archiver:
self.__dist_zip = None
def push_dir(self, arcname: Path) -> None:
"""Create an empty directory entry in both sinks.
:param arcname: Directory path relative to the distribution root.
Parent directories are created as needed for the directory sink.
"""
if self.__dist_dir is not None:
target_filepath = self.__dist_dir / arcname
target_filepath.parent.mkdir(parents=True, exist_ok=True)