summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Defaults.py
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins@gmail.com>2014-07-14 01:45:07 (GMT)
committerWilliam Blevins <wblevins@gmail.com>2014-07-14 01:45:07 (GMT)
commit5e3450b0552434281ba82e68ddd150f5d86e85d5 (patch)
tree499b10e8985161b0ee33895541025409ebcc22b6 /src/engine/SCons/Defaults.py
parent235e89d5f6f412c007a6cda4022730bd5d693b83 (diff)
downloadSCons-5e3450b0552434281ba82e68ddd150f5d86e85d5.zip
SCons-5e3450b0552434281ba82e68ddd150f5d86e85d5.tar.gz
SCons-5e3450b0552434281ba82e68ddd150f5d86e85d5.tar.bz2
Issue 2395: Copy Symlink soft-copy enhancement.
Diffstat (limited to 'src/engine/SCons/Defaults.py')
-rw-r--r--src/engine/SCons/Defaults.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index 563e5a8..b91a685 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -181,20 +181,30 @@ def chmod_strfunc(dest, mode):
Chmod = ActionFactory(chmod_func, chmod_strfunc)
-def copy_func(dest, src):
+def copy_func(dest, src, symlinks=True):
+ dest = str(dest)
+ src = str(src)
+
SCons.Node.FS.invalidate_node_memos(dest)
if SCons.Util.is_List(src) and os.path.isdir(dest):
for file in src:
shutil.copy2(file, dest)
return 0
+ elif os.path.islink(src):
+ linkto = os.readlink(src)
+ if symlinks:
+ return os.symlink(linkto, dest)
+ else:
+ return copy_func(dest, linkto, symlinks)
elif os.path.isfile(src):
return shutil.copy2(src, dest)
else:
- return shutil.copytree(src, dest, 1)
+ return shutil.copytree(src, dest, symlinks)
-Copy = ActionFactory(copy_func,
- lambda dest, src: 'Copy("%s", "%s")' % (dest, src),
- convert=str)
+Copy = ActionFactory(
+ copy_func,
+ lambda dest, src, symlinks=True: 'Copy("%s", "%s")' % (dest, src)
+)
def delete_func(dest, must_exist=0):
SCons.Node.FS.invalidate_node_memos(dest)