From 3d5118d406db52ec0a701270d71522864b425578 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 28 May 2014 15:55:18 +0000 Subject: [PATCH] Unlink symlink before re-creating --- makepanda/makepandacore.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 93c2ba3bf6..5ee36e6c91 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2328,15 +2328,20 @@ def SetupBuildEnvironment(compiler): ######################################################################## def CopyFile(dstfile, srcfile): - if (dstfile[-1]=='/'): + if dstfile[-1] == '/': dstdir = dstfile fnl = srcfile.rfind("/") - if (fnl < 0): fn = srcfile - else: fn = srcfile[fnl+1:] + if fnl < 0: + fn = srcfile + else: + fn = srcfile[fnl+1:] dstfile = dstdir + fn + if NeedsBuild([dstfile], [srcfile]): if os.path.islink(srcfile): # Preserve symlinks + if os.path.exists(dstfile): + os.unlink(dstfile) os.symlink(os.readlink(srcfile), dstfile) else: WriteBinaryFile(dstfile, ReadBinaryFile(srcfile))