Use dirs_exist_ok=True, refs #744 (#768)

This commit is contained in:
Simon Willison 2020-05-21 10:53:51 -07:00 committed by GitHub
commit cee671a58f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -602,9 +602,9 @@ def link_or_copy(src, dst):
def link_or_copy_directory(src, dst):
try:
shutil.copytree(src, dst, copy_function=os.link)
shutil.copytree(src, dst, copy_function=os.link, dirs_exist_ok=True)
except OSError:
shutil.copytree(src, dst)
shutil.copytree(src, dst, dirs_exist_ok=True)
def module_from_path(path, name):