blob: c2a04da94b5ca654e904e70ee875bb5b56d5821b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)
|