Skip to content

Commit

Permalink
OmeroBuild : Adding call to growlnotify to build.py
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/svn/omero/trunk@6067 05709c45-44f0-0310-885b-81a1db45b4a6
  • Loading branch information
joshmoore committed Feb 10, 2010
1 parent 3d4d928 commit db4ad45
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

0 comments on commit db4ad45

Please sign in to comment.