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