Skip to content

Commit

Permalink
utils: handle merging directories containing same-named read-only files
Browse files Browse the repository at this point in the history
Fixes #54.

* docrepr/utils.py (merge_directories): Also handle 'shutil.Error'
exceptions.
  • Loading branch information
Apteryks committed Jun 11, 2022
1 parent e0b2309 commit 002eb3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docrepr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def merge_directories(source, destination):
"""Merge a source into a dest dir; compat shim for Python <3.8."""
try:
shutil.copytree(source, destination, dirs_exist_ok=True)
except TypeError:
except (TypeError, shutil.Error):
# XXX: Also handle shutil.Error, which can occur when
# shutil.copytree attempts to merge directories containing
# same-named read-only files. This case is correctly handled
# by the manual copy routine below.
pass
else:
return
Expand Down

0 comments on commit 002eb3e

Please sign in to comment.