Count untraced errors in make.py (#5265)

* Count untraced errors (any errors besides failed PBO builds and missinf files) in make.py

* Fix error count and prettify printing
This commit is contained in:
jonpas 2017-06-14 15:34:35 +02:00 committed by GitHub
parent 3034212701
commit 2d95bb1aad

View File

@ -30,7 +30,7 @@
###############################################################################
__version__ = "0.8"
__version__ = "0.9"
import sys
@ -248,7 +248,7 @@ def find_depbo_tools(regKey):
winreg.CloseKey(k)
print("Found pboproject.")
except:
print_error("ERROR: Could not find pboProject.")
print_error("Could not find pboProject.")
try:
k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\rapify")
@ -308,8 +308,10 @@ def color(color):
def print_error(msg):
color("red")
print ("ERROR: {}".format(msg))
print("ERROR: {}".format(msg))
color("reset")
global printedErrors
printedErrors += 1
def print_green(msg):
color("green")
@ -808,6 +810,10 @@ def main(argv):
global pbo_name_prefix
global ciBuild
global missingFiles
global failedBuilds
global printedErrors
printedErrors = 0
if sys.platform != "win32":
print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.")
@ -1223,7 +1229,7 @@ See the make.cfg file for additional build options.
except:
raise
print_error("ERROR: Could not copy module to work drive. Does the module exist?")
print_error("Could not copy module to work drive. Does the module exist?")
input("Press Enter to continue...")
print("Resuming build...")
continue
@ -1244,7 +1250,7 @@ See the make.cfg file for additional build options.
os.remove(f)
except:
raise
print_error("ERROR: Could not copy module to work drive. Does the module exist?")
print_error("Could not copy module to work drive. Does the module exist?")
input("Press Enter to continue...")
print("Resuming build...")
continue
@ -1484,24 +1490,23 @@ See the make.cfg file for additional build options.
except:
print_error("Could not copy files. Is Arma 3 running?")
if len(failedBuilds) > 0 or len(missingFiles) > 0:
tracedErrors = len(failedBuilds) + len(missingFiles)
if printedErrors > 0: # printedErrors includes tracedErrors
printedOnlyErrors = printedErrors - tracedErrors
print()
print_error("Failed with {} errors.".format(printedErrors))
if len(failedBuilds) > 0:
print()
print_error("Build failed! {} PBOs failed!".format(len(failedBuilds)))
for failedBuild in failedBuilds:
print("- {} failed.".format(failedBuild))
print("- {} build failed!".format(failedBuild))
if len(missingFiles) > 0:
missingFiles = set(missingFiles)
print()
print_error("Missing files! {} files not found!".format(len(missingFiles)))
for missingFile in missingFiles:
print("- {} failed.".format(missingFile))
sys.exit(1)
print("- {} not found!".format(missingFile))
if printedOnlyErrors > 0:
print_yellow("- {} untraced error(s)!".format(printedOnlyErrors))
else:
print_green("\nCompleted with 0 errors.")
if __name__ == "__main__":
start_time = timeit.default_timer()
main(sys.argv)