From 258d3220fe30cf6ccb271d15414a48c20f17e923 Mon Sep 17 00:00:00 2001 From: Bill Gianopoulos Date: Sun, 1 Jan 2017 10:27:00 -0500 Subject: [PATCH] Bug 1328153 - Change Linux notify to use the system command notify-send to avoid freedesktop dependency, r=gps --HG-- extra : rebase_source : f9181c91827f5b67b5a9be3af81c08d51c4b0226 --- python/mozbuild/mozbuild/base.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index a50b8ff8908c6..205af40926dcf 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -386,16 +386,13 @@ def notify(self, msg): '-message', msg], ensure_exit_code=False) elif sys.platform.startswith('linux'): try: - import dbus - except ImportError: - raise Exception('Install the python dbus module to ' - 'get a notification when the build finishes.') - bus = dbus.SessionBus() - notify = bus.get_object('org.freedesktop.Notifications', - '/org/freedesktop/Notifications') - method = notify.get_dbus_method('Notify', - 'org.freedesktop.Notifications') - method('Mozilla Build System', 0, '', msg, '', [], [], -1) + notifier = which.which('notify-send') + except which.WhichError: + raise Exception('Install notify-send (usually part of ' + 'the libnotify package) to get a notification when ' + 'the build finishes.') + self.run_process([notifier, '--app-name=Mozilla Build System', + 'Mozilla Build System', msg], ensure_exit_code=False) elif sys.platform.startswith('win'): from ctypes import Structure, windll, POINTER, sizeof from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT