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