Skip to content

Commit 421fe31

Browse files
committed
fix: Use shutil.copytree() to copy directories
1 parent 09de352 commit 421fe31

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

htmltools/_core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,10 @@ def copy_to(self, path: str, include_version: bool = True) -> None:
16261626
src_file = os.path.join(paths["source"], f)
16271627
target_file = os.path.join(target_dir, f)
16281628
os.makedirs(os.path.dirname(target_file), exist_ok=True)
1629-
shutil.copy2(src_file, target_file)
1629+
if os.path.isfile(src_file):
1630+
shutil.copy2(src_file, target_file)
1631+
elif os.path.isdir(src_file):
1632+
shutil.copytree(src_file, target_file)
16301633

16311634
def _validate_dicts(self, ld: Iterable[object], req_attr: list[str]) -> None:
16321635
for d in ld:

0 commit comments

Comments
 (0)