"""Overlay copy handling.""" from __future__ import annotations import os import shutil def copy_overlay(src: str, dest_root: str) -> None: if not src or not os.path.isdir(src): return for entry in os.listdir(src): src_path = os.path.join(src, entry) dest_path = os.path.join(dest_root, entry) if os.path.isdir(src_path): shutil.copytree(src_path, dest_path, symlinks=True, dirs_exist_ok=True) else: os.makedirs(os.path.dirname(dest_path), exist_ok=True) shutil.copy2(src_path, dest_path, follow_symlinks=True)