diff options
Diffstat (limited to 'jprov/overlay.py')
| -rw-r--r-- | jprov/overlay.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/jprov/overlay.py b/jprov/overlay.py new file mode 100644 index 0000000..c2a04da --- /dev/null +++ b/jprov/overlay.py @@ -0,0 +1,20 @@ +"""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) |
