Issue #21697: shutil.copytree() now correctly handles symbolic links that point to directories.

Patch by Eduardo Seabra and Thomas Kluyver.
This commit is contained in:
Berker Peksag 2015-07-25 14:53:48 +03:00
parent 7e732a7181
commit 5a294d822b
3 changed files with 28 additions and 1 deletions

View file

@ -321,7 +321,11 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
if not os.path.exists(linkto) and ignore_dangling_symlinks:
continue
# otherwise let the copy occurs. copy2 will raise an error
copy_function(srcname, dstname)
if os.path.isdir(srcname):
copytree(srcname, dstname, symlinks, ignore,
copy_function)
else:
copy_function(srcname, dstname)
elif os.path.isdir(srcname):
copytree(srcname, dstname, symlinks, ignore, copy_function)
else: