diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-08-16 16:52:54 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-08-16 14:38:02 +0000 |
commit | 1e140f7d0ae1228b30154aeb87022e5d188cca9b (patch) | |
tree | c22a822cdfad2623c5d6999363094c90f7b8e2ea | |
parent | 43f4ffba5e542fc16c97eb2eb4133daed1b5fd84 (diff) | |
download | buildstream-1e140f7d0ae1228b30154aeb87022e5d188cca9b.tar.gz |
_frontend/app.py: Notify session completions
Use the optionally implemented desktop notification method
to notify when a session completes.
Previously, this used to only notify when an interactive prompt
appears.
This is an attempt to fix #385
-rw-r--r-- | buildstream/_frontend/app.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py index cdc60a90d..e32b87020 100644 --- a/buildstream/_frontend/app.py +++ b/buildstream/_frontend/app.py @@ -270,6 +270,9 @@ class App(): else: self._message(MessageType.FAIL, session_name, elapsed=elapsed) + # Notify session failure + self._notify("{} failed".format(session_name), "{}".format(e)) + if self._started: self._print_summary() @@ -287,6 +290,9 @@ class App(): if self._started: self._print_summary() + # Notify session success + self._notify("{} succeeded".format(session_name), "") + # init_project() # # Initialize a new BuildStream project, either with the explicitly passed options, @@ -420,6 +426,12 @@ class App(): # Local Functions # ############################################################ + # Local function for calling the notify() virtual method + # + def _notify(self, title, text): + if self.interactive: + self.notify(title, text) + # Local message propagator # def _message(self, message_type, message, **kwargs): @@ -572,8 +584,8 @@ class App(): while choice not in ['continue', 'quit', 'terminate', 'retry']: click.echo(summary, err=True) - self.notify("BuildStream failure", "{} on element {}" - .format(failure.action_name, element.name)) + self._notify("BuildStream failure", "{} on element {}" + .format(failure.action_name, element.name)) try: choice = click.prompt("Choice:", default='continue', err=True, |