Backport of Python 3.8 shutil.copytree, refs #744 (#769)

This commit is contained in:
Simon Willison 2020-05-27 11:17:43 -07:00 committed by GitHub
commit 2d099ad9c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 104 additions and 2 deletions

View file

@ -15,6 +15,7 @@ import shutil
import urllib
import numbers
import yaml
from .shutil_backport import copytree
try:
import pysqlite3 as sqlite3
@ -602,9 +603,9 @@ def link_or_copy(src, dst):
def link_or_copy_directory(src, dst):
try:
shutil.copytree(src, dst, copy_function=os.link, dirs_exist_ok=True)
copytree(src, dst, copy_function=os.link, dirs_exist_ok=True)
except OSError:
shutil.copytree(src, dst, dirs_exist_ok=True)
copytree(src, dst, dirs_exist_ok=True)
def module_from_path(path, name):