INNER CODE UNIT · Python
_ensure_base_path
terraform-aws-modules/terraform-aws-lambda · package.py:389
def _ensure_base_path(self, zip_filename):
archive_dir = os.path.dirname(zip_filename)
if archive_dir and not os.path.exists(archive_dir):
self._log.info("creating %s", archive_dir)
os.makedirs(archive_dir, exist_ok=True)
def write_dirs(self, *base_dirs, prefix=None, timestamp=None):
"""
Writes a directory content to a prefix inside of a zip archive
"""
self._ensure_open()
for base_dir in base_dirs:
if not self.quiet:
self._log.info("adding content of directory: %s", base_dir)
for path in emit_dir_content(base_dir):
arcname = os.path.relpath(path, base_dir)
self._write_file(path, prefix, arcname, timestamp)