From 8ae5e58d92542ab395949ae26a582b41cb44fbc1 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 17 Mar 2014 13:26:58 +0000 Subject: [PATCH] Preserve symlinks when copying files --- makepanda/makepandacore.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 0c760d30a0..ec7e661d21 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2333,8 +2333,12 @@ def CopyFile(dstfile, srcfile): if (fnl < 0): fn = srcfile else: fn = srcfile[fnl+1:] dstfile = dstdir + fn - if (NeedsBuild([dstfile], [srcfile])): - WriteBinaryFile(dstfile, ReadBinaryFile(srcfile)) + if NeedsBuild([dstfile], [srcfile]): + if os.path.islink(srcfile): + # Preserve symlinks + os.symlink(os.readlink(srcfile), dstfile) + else: + WriteBinaryFile(dstfile, ReadBinaryFile(srcfile)) JustBuilt([dstfile], [srcfile]) def CopyAllFiles(dstdir, srcdir, suffix=""):