summaryrefslogtreecommitdiff
path: root/engine/SCons/Defaults.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-08-25 15:11:37 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-08-25 15:11:37 +0200
commit765fbac29295fb4e462c480d09dbdb2f9718a845 (patch)
tree73104b2debe81c91a5ac638a5b90fd6acbfb3918 /engine/SCons/Defaults.py
parent8bf6d55f69eb30ba1c0c6a798e81c2c67a507342 (diff)
Imported Upstream version 2.3.3upstream/2.3.3
Diffstat (limited to 'engine/SCons/Defaults.py')
-rw-r--r--engine/SCons/Defaults.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/engine/SCons/Defaults.py b/engine/SCons/Defaults.py
index 9e33bfa..4d36e95 100644
--- a/engine/SCons/Defaults.py
+++ b/engine/SCons/Defaults.py
@@ -33,7 +33,7 @@ from distutils.msvccompiler.
#
from __future__ import division
-__revision__ = "src/engine/SCons/Defaults.py 2014/07/05 09:42:21 garyo"
+__revision__ = "src/engine/SCons/Defaults.py 2014/08/24 12:12:31 garyo"
import os
@@ -181,20 +181,37 @@ def chmod_strfunc(dest, mode):
Chmod = ActionFactory(chmod_func, chmod_strfunc)
-def copy_func(dest, src):
+def copy_func(dest, src, symlinks=True):
+ """
+ If symlinks (is true), then a symbolic link will be
+ shallow copied and recreated as a symbolic link; otherwise, copying
+ a symbolic link will be equivalent to copying the symbolic link's
+ final target regardless of symbolic link depth.
+ """
+
+ 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)