diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-07-25 11:53:48 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-07-25 11:53:48 (GMT) |
commit | 5a294d822b7f5732135662907ec1a1d4a7b0fc9a (patch) | |
tree | 641599f8af6bc9f7879fe73012747e5b41591518 /Lib/shutil.py | |
parent | 7e732a7181ab6debfe5df33bfc29035d522dfef9 (diff) | |
download | cpython-5a294d822b7f5732135662907ec1a1d4a7b0fc9a.zip cpython-5a294d822b7f5732135662907ec1a1d4a7b0fc9a.tar.gz cpython-5a294d822b7f5732135662907ec1a1d4a7b0fc9a.tar.bz2 |
Issue #21697: shutil.copytree() now correctly handles symbolic links that point to directories.
Patch by Eduardo Seabra and Thomas Kluyver.
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r-- | Lib/shutil.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index ac06ae5..e87d18e 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -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: |