From db4ad45478aa0dfdb2c38cf2519e19e69b3820af Mon Sep 17 00:00:00 2001 From: jmoore Date: Wed, 10 Feb 2010 12:19:49 +0000 Subject: [PATCH] OmeroBuild : Adding call to growlnotify to build.py git-svn-id: file:///home/svn/omero/trunk@6067 05709c45-44f0-0310-885b-81a1db45b4a6 --- build.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/build.py b/build.py index b63cdca9940..3b2f61ed496 100755 --- a/build.py +++ b/build.py @@ -9,8 +9,28 @@ import os import sys +import time import subprocess +def notification(msg, prio): + """ + Provides UI notification. + """ + + # May want to revert this to be OMERO_BUILD_NOTIFICATION, or whatever. + if "OMERO_QUIET" in os.environ: + return + + try: + p = subprocess.Popen(["growlnotify","-t","OMERO Build Status","-p",str(prio)],\ + stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + p.communicate(msg) + rc = p.wait() + if rc != 0: + pass # growl didn't work + except OSError: + pass # No growlnotify found, may want to use another tool + def build_hudson(): """ Top-level build called by hudson for testing all components, @@ -108,6 +128,9 @@ def execute(args): build_hudson() else: java_omero(args) + notification(""" Finished: %s """ % " ".join(args), 0) except KeyboardInterrupt: sys.stderr.write("\nCancelled by user\n") sys.exit(2) + except SystemExit: + notification(""" Failed: %s """ % " ".join(args), 100)