Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2008-06-28 03:05:43 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2008-06-28 03:05:43 (GMT)
commitf98a8d2931bef72b46ee9a92208877930d3a2663 (patch)
tree6835778a8025dfe06804973054886a1e7ae71d3a /scripts
parentc54d1b403e7fba5406920005bcfaabe5d4827927 (diff)
Add ability to send reports by email.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/report.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/scripts/report.py b/scripts/report.py
index f18aef7..9a25a27 100644
--- a/scripts/report.py
+++ b/scripts/report.py
@@ -3,6 +3,9 @@ import sys
import urllib
import csv
import json
+import smtplib
+from optparse import make_option
+import StringIO
from jhbuild.commands import Command, register_command
@@ -101,6 +104,13 @@ class cmd_report(Command):
name = 'report'
usage_args = ''
+ def __init__(self):
+ Command.__init__(self, [
+ make_option('-s', '--sendto', action='append',
+ dest='sendto', default=None,
+ help='send report to the specified mail address')
+ ])
+
def run(self, config, options, args):
report = None
@@ -109,7 +119,24 @@ class cmd_report(Command):
report.generate()
if report:
- report.write(TextWriter(sys.stdout))
+ out = StringIO.StringIO()
+ report.write(TextWriter(out))
+ text = out.getvalue()
+ out.close()
+
+ if options.sendto:
+ if text:
+ print 'Sending to ' + ', '.join(options.sendto)
+
+ server = smtplib.SMTP('localhost')
+ from_address = 'release-team@sugarlabs.org'
+
+ for to_address in options.sendto:
+ server.sendmail(from_address, to_address, text)
+
+ server.quit()
+ else:
+ print 'Empty report, do not send'
report.save()