From c0f74e9da30df37640153835d0836a6ac4f9c413 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 19 Feb 2012 09:24:22 +0000 Subject: [PATCH] CopyTree should update altered files properly --- makepanda/makepandacore.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 3c085b6af7..10ca5295a2 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1910,7 +1910,7 @@ def CheckLinkerLibraryPath(): ## ######################################################################## -def CopyFile(dstfile,srcfile): +def CopyFile(dstfile, srcfile): if (dstfile[-1]=='/'): dstdir = dstfile fnl = srcfile.rfind("/") @@ -1933,13 +1933,23 @@ def CopyAllHeaders(dir, skip=[]): WriteFile(dstfile,ReadFile(srcfile)) JustBuilt([dstfile],[srcfile]) -def CopyTree(dstdir,srcdir): - if (os.path.isdir(dstdir)): return 0 - if (sys.platform == "win32"): - cmd = 'xcopy /I/Y/E/Q "' + srcdir + '" "' + dstdir + '"' +def CopyTree(dstdir, srcdir, omitCVS=True): + if (os.path.isdir(dstdir)): + for entry in os.listdir(srcdir): + srcpth = os.path.join(srcdir, entry) + dstpth = os.path.join(dstdir, entry) + if (os.path.isfile(srcpth)): + if (not omitCVS or entry != ".cvsignore"): + CopyFile(dstpth, srcpth) + else: + if (not omitCVS or entry != "CVS"): + CopyTree(dstpth, srcpth) else: - cmd = 'cp -R -f ' + srcdir + ' ' + dstdir - oscmd(cmd) + if (sys.platform == "win32"): + cmd = 'xcopy /I/Y/E/Q "' + srcdir + '" "' + dstdir + '"' + else: + cmd = 'cp -R -f ' + srcdir + ' ' + dstdir + oscmd(cmd) ######################################################################## ##