Implement skip for zone dependency process
This commit is contained in:
parent
a5282ccb7e
commit
8dc1a89440
2 changed files with 87 additions and 17 deletions
|
@ -82,6 +82,13 @@ def copyFileList(log, dir_source, dir_target, files):
|
|||
if needUpdateLogRemoveDest(log, dir_source + "/" + fileName, dir_target + "/" + fileName):
|
||||
shutil.copy(dir_source + "/" + fileName, dir_target + "/" + fileName)
|
||||
|
||||
def copyFileListLogless(log, dir_source, dir_target, files):
|
||||
for fileName in files:
|
||||
if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*":
|
||||
if (os.path.isfile(dir_source + "/" + fileName)):
|
||||
if needUpdateRemoveDest(log, dir_source + "/" + fileName, dir_target + "/" + fileName):
|
||||
shutil.copy(dir_source + "/" + fileName, dir_target + "/" + fileName)
|
||||
|
||||
def copyFileListNoTree(log, dir_source, dir_target, files):
|
||||
for fileName in files:
|
||||
if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*":
|
||||
|
@ -145,6 +152,9 @@ def copyFilesRecursive(log, dir_source, dir_target):
|
|||
def copyFiles(log, dir_source, dir_target):
|
||||
copyFileList(log, dir_source, dir_target, os.listdir(dir_source))
|
||||
|
||||
def copyFilesLogless(log, dir_source, dir_target):
|
||||
copyFileListLogless(log, dir_source, dir_target, os.listdir(dir_source))
|
||||
|
||||
def copyFilesExt(log, dir_source, dir_target, file_ext):
|
||||
files = os.listdir(dir_source)
|
||||
len_file_ext = len(file_ext)
|
||||
|
@ -288,6 +298,31 @@ def findFile(log, dir_where, file_name):
|
|||
printLog(log, "findFile: file not dir or file?! " + filePath)
|
||||
return ""
|
||||
|
||||
def needUpdateDirByLowercaseTagLog(log, dir_source, ext_source, dir_dest, ext_dest):
|
||||
updateCount = 0
|
||||
skipCount = 0
|
||||
lenSrcExt = len(ext_source)
|
||||
sourceFiles = findFilesNoSubdir(log, dir_source, ext_source)
|
||||
destFiles = findFilesNoSubdir(log, dir_dest, ext_dest)
|
||||
for file in sourceFiles:
|
||||
sourceFile = dir_source + "/" + file
|
||||
tagFile = dir_dest + "/" + file[0:-lenSrcExt].lower() + ext_dest
|
||||
if os.path.isfile(tagFile):
|
||||
sourceTime = os.stat(sourceFile).st_mtime
|
||||
tagTime = os.stat(tagFile).st_mtime
|
||||
if (sourceTime > tagTime):
|
||||
updateCount = updateCount + 1
|
||||
else:
|
||||
skipCount = skipCount + 1
|
||||
else:
|
||||
updateCount = updateCount + 1
|
||||
if updateCount > 0:
|
||||
printLog(log, "UPDATE " + str(updateCount) + " / " + str(len(sourceFiles)) + "; SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles)))
|
||||
return 1
|
||||
else:
|
||||
printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles)))
|
||||
return 0
|
||||
|
||||
def needUpdateDirByTagLog(log, dir_source, ext_source, dir_dest, ext_dest):
|
||||
updateCount = 0
|
||||
skipCount = 0
|
||||
|
@ -327,6 +362,21 @@ def needUpdateDirNoSubdirFile(log, dir_source, file_dest):
|
|||
else:
|
||||
return 0
|
||||
|
||||
def needUpdateFileDirNoSubdir(log, file_source, dir_dest):
|
||||
if not os.path.isfile(file_source):
|
||||
printLog(log, "WARNING MISSING " + file_source)
|
||||
return 0
|
||||
sourceTime = os.stat(file_source).st_mtime
|
||||
destFiles = os.listdir(dir_dest)
|
||||
for file in destFiles:
|
||||
filePath = dir_dest + "/" + file
|
||||
if os.path.isfile(filePath):
|
||||
fileTime = os.stat(filePath).st_mtime
|
||||
if sourceTime > fileTime:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
def needUpdateDirNoSubdirMultiFile(log, dir_source, root_file, files_dest):
|
||||
for file_dest in files_dest:
|
||||
if needUpdateDirNoSubdirFile(log, dir_source, root_file + "/" + file_dest):
|
||||
|
|
|
@ -59,6 +59,23 @@ if BuildQuality == 1:
|
|||
else:
|
||||
mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory)
|
||||
mkPath(log, ExportBuildDirectory + "/" + ZoneDependBuildDirectory)
|
||||
needUpdateZoneDepend = needUpdateDirByLowercaseTagLog(log, ExportBuildDirectory + "/" + ZoneExportDirectory, ".zone", ExportBuildDirectory + "/" + ZoneDependBuildDirectory, ".depend")
|
||||
if needUpdateZoneDepend:
|
||||
printLog(log, "DETECT UPDATE Zone->Depend")
|
||||
else:
|
||||
printLog(log, "DETECT SKIP Zone->Depend")
|
||||
needUpdateContinentDepend = needUpdateFileDirNoSubdir(log, LeveldesignWorldDirectory + "/" + ContinentFile, ExportBuildDirectory + "/" + ZoneDependBuildDirectory)
|
||||
if needUpdateContinentDepend:
|
||||
printLog(log, "DETECT UPDATE Continent->Depend")
|
||||
else:
|
||||
printLog(log, "DETECT SKIP Continent->Depend")
|
||||
needUpdateSearchPaths = needUpdateMultiDirNoSubdir(log, ExportBuildDirectory, PropertiesExportBuildSearchPaths, ExportBuildDirectory + "/" + ZoneDependBuildDirectory)
|
||||
if needUpdateSearchPaths:
|
||||
printLog(log, "DETECT UPDATE SearchPaths->Depend")
|
||||
else:
|
||||
printLog(log, "DETECT SKIP SearchPaths->Depend")
|
||||
if needUpdateZoneDepend or needUpdateContinentDepend or needUpdateSearchPaths:
|
||||
printLog(log, "DETECT DECIDE UPDATE")
|
||||
mkPath(log, ActiveProjectDirectory + "/generated")
|
||||
configFile = ActiveProjectDirectory + "/generated/zone_dependencies.cfg"
|
||||
templateCf = open(ActiveProjectDirectory + "/generated/properties.cfg", "r")
|
||||
|
@ -74,8 +91,11 @@ if BuildQuality == 1:
|
|||
cf.close()
|
||||
|
||||
for zoneRegion in ZoneRegions:
|
||||
# zone_dependencies [properties.cfg] [firstZone.zone] [lastzone.zone] [output_dependencies.cfg]
|
||||
subprocess.call([ ExecTimeout, str(ZoneBuildDependTimeout), ZoneDependencies, configFile, ExportBuildDirectory + "/" + ZoneExportDirectory + "/" + zoneRegion[0] + ".zone", ExportBuildDirectory + "/" + ZoneExportDirectory + "/" + zoneRegion[1] + ".zone", ExportBuildDirectory + "/" + ZoneDependBuildDirectory + "/doomy.depend" ])
|
||||
|
||||
else:
|
||||
printLog(log, "DETECT DECIDE SKIP")
|
||||
printLog(log, "SKIP *")
|
||||
printLog(log, "")
|
||||
|
||||
# For each zone directory
|
||||
|
|
Loading…
Reference in a new issue