From 4ef59754a4b4ba900d922afb8aba31a3bad61608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 29 Aug 2018 11:08:56 +0200 Subject: [PATCH] Donate CPU: Added a '--stop-time' argument --- tools/donate-cpu.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/donate-cpu.py b/tools/donate-cpu.py index aa64a4c5e..2bb851dac 100644 --- a/tools/donate-cpu.py +++ b/tools/donate-cpu.py @@ -189,7 +189,11 @@ def uploadResults(package, results): pass return package - +stopTime = None +for arg in sys.argv[1:]: + # --stop-time=12:00 => run until ~12:00 and then stop + if arg.startswith('--stop-time='): + stopTime = arg[-5:] print('Thank you!') if not checkRequirements(): sys.exit(1) @@ -198,6 +202,11 @@ if not os.path.exists(workpath): os.mkdir(workpath) cppcheckPath = workpath + '/cppcheck' while True: + if stopTime: + print('stopTime:' + stopTime + '. Time:' + time.strftime('%H:%M') + '.') + if stopTime < time.strftime('%H:%M'): + print('Stopping. Thank you!') + sys.exit(0) if not getCppcheck(cppcheckPath): print('Failed to clone Cppcheck, retry later') sys.exit(1)