[Libreoffice-commits] dev-tools.git: esc-reporting/esc-report.py

jan Iversen jani at libreoffice.org
Sun May 21 08:49:01 UTC 2017


 esc-reporting/esc-report.py |   33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

New commits:
commit 4e28b62a6d9bdeeed42958a23e225f803006be05
Author: jan Iversen <jani at libreoffice.org>
Date:   Sun May 21 10:48:38 2017 +0200

    esc-report, changed mail-from to mentoring@

diff --git a/esc-reporting/esc-report.py b/esc-reporting/esc-report.py
index 9ff728b..6444755 100755
--- a/esc-reporting/esc-report.py
+++ b/esc-reporting/esc-report.py
@@ -40,6 +40,15 @@ import json
 import xmltodict
 
 
+
+
+def util_errorMail(text):
+    print(text)
+    sendMail = 'mail -r mentoring at libreoffice.org -s "ERROR: esc-report FAILED" mentoring at libreoffice.org <<EOF\n' + text + '\nPlease have a look at vm174\nEOF\n'
+    os.system(sendMail)
+
+
+
 def util_load_data_file(fileName):
     try:
       fp = open(fileName, encoding='utf-8')
@@ -739,7 +748,6 @@ def runCfg(platform):
     cfg['platform'] = platform
     print("Reading and writing data to " + cfg['homedir'])
 
-    cfg['award-mailed'] = util_load_data_file(cfg['homedir'] + 'award.json')['award-mailed']
     cfg['nowDate'] = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
     cfg['cutDate'] = cfg['nowDate'] - datetime.timedelta(days=365)
     cfg['1weekDate'] = cfg['nowDate'] - datetime.timedelta(days=7)
@@ -761,62 +769,59 @@ def runReport():
       if not x is None:
         xMail.append(x)
     except Exception as e:
-      print('ERROR: report_bug_metrics failed with ' + str(e))
+      util_errorMail('ERROR: report_bug_metrics failed with ' + str(e))
       pass
     try:
       x = report_day_mentoring()
       if not x is None:
         xMail.append(x)
     except Exception as e:
-      print('ERROR: report_day_mentoring failed with ' + str(e))
+      util_errorMail('ERROR: report_day_mentoring failed with ' + str(e))
       pass
     try:
       x = report_mentoring()
       if not x is None:
         xMail.append(x)
     except Exception as e:
-      print('ERROR: report_mentoring failed with ' + str(e))
+      util_errorMail('ERROR: report_mentoring failed with ' + str(e))
       pass
     try:
       x = report_ui()
       if not x is None:
         xMail.append(x)
     except Exception as e:
-      print('ERROR: report_ui failed with ' + str(e))
+      util_errorMail('ERROR: report_ui failed with ' + str(e))
       pass
     try:
       x = report_qa()
       if not x is None:
         xMail.append(x)
     except Exception as e:
-      print('ERROR: report_qa failed with ' + str(e))
+      util_errorMail('ERROR: report_qa failed with ' + str(e))
       pass
     try:
       x = report_myfunc()
       if not x is None:
         xMail.append(x)
     except Exception as e:
-      print('ERROR: report_myfunc failed with ' + str(e))
+      util_errorMail('ERROR: report_myfunc failed with ' + str(e))
       pass
     try:
       x = report_esc_prototype()
       if not x is None:
         xMail.append(x)
     except Exception as e:
-      print('ERROR: report_esc_prototype failed with ' + str(e))
+      util_errorMail('ERROR: report_esc_prototype failed with ' + str(e))
       pass
 
-    fp = open('/tmp/runMail', 'w', encoding='utf-8')
-    print("#!/bin/bash", file=fp)
-    print("")
     for i in xMail:
       if 'attach' in i:
         attach = '-a ' + i['attach'] + ' '
       else:
         attach = ''
-      print("mail -s '" + i['title'] + "' " + attach + i['mail'] + " <  " + i['file'], file=fp)
-    fp.close()
-
+      r = os.system("mail -r mentoring at libreoffice.org -s '" + i['title'] + "' " + attach + i['mail'] + " <  " + i['file'])
+      if r != 0:
+        util_errorMail('ERROR: mailing failed with ' + str(e))
 
 
 if __name__ == '__main__':


More information about the Libreoffice-commits mailing list