CopyTree should update altered files properly

This commit is contained in:
rdb 2012-02-19 09:24:22 +00:00
parent f5d6dc7bfe
commit c0f74e9da3

View File

@ -1910,7 +1910,7 @@ def CheckLinkerLibraryPath():
## ##
######################################################################## ########################################################################
def CopyFile(dstfile,srcfile): def CopyFile(dstfile, srcfile):
if (dstfile[-1]=='/'): if (dstfile[-1]=='/'):
dstdir = dstfile dstdir = dstfile
fnl = srcfile.rfind("/") fnl = srcfile.rfind("/")
@ -1933,13 +1933,23 @@ def CopyAllHeaders(dir, skip=[]):
WriteFile(dstfile,ReadFile(srcfile)) WriteFile(dstfile,ReadFile(srcfile))
JustBuilt([dstfile],[srcfile]) JustBuilt([dstfile],[srcfile])
def CopyTree(dstdir,srcdir): def CopyTree(dstdir, srcdir, omitCVS=True):
if (os.path.isdir(dstdir)): return 0 if (os.path.isdir(dstdir)):
if (sys.platform == "win32"): for entry in os.listdir(srcdir):
cmd = 'xcopy /I/Y/E/Q "' + srcdir + '" "' + dstdir + '"' 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: else:
cmd = 'cp -R -f ' + srcdir + ' ' + dstdir if (sys.platform == "win32"):
oscmd(cmd) cmd = 'xcopy /I/Y/E/Q "' + srcdir + '" "' + dstdir + '"'
else:
cmd = 'cp -R -f ' + srcdir + ' ' + dstdir
oscmd(cmd)
######################################################################## ########################################################################
## ##