doc: add docstring and do some refactor
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user