Bug 1328153 - Change Linux notify to use the system command notify-send to avoid freedesktop dependency, r=gps

--HG--
extra : rebase_source : f9181c91827f5b67b5a9be3af81c08d51c4b0226
This commit is contained in:
Bill Gianopoulos 2017-01-01 10:27:00 -05:00
parent c6411b5c55
commit 258d3220fe

View File

@ -386,16 +386,13 @@ class MozbuildObject(ProcessExecutionMixin):
'-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