aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/build_commands.py
diff options
context:
space:
mode:
authorMichael Tremel <itrekkie@gmail.com>2015-06-27 17:13:36 -0700
committerMichael Tremel <itrekkie@gmail.com>2015-06-27 17:13:36 -0700
commitbb426d3575565becb245f7ac952314f5cf362a71 (patch)
treeb1c0a59d3d1e08e28ea02004797bd9ae9c7f3398 /python/servo/build_commands.py
parent46709edaf839eb77893eef3f4d01c568c46c98fe (diff)
downloadservo-bb426d3575565becb245f7ac952314f5cf362a71.tar.gz
servo-bb426d3575565becb245f7ac952314f5cf362a71.zip
notify_darwin should trap import errors and provide the useful package name for the user to install.
Diffstat (limited to 'python/servo/build_commands.py')
-rw-r--r--python/servo/build_commands.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 74509da6b3e..dd2fbb52c8e 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -64,21 +64,24 @@ def notify_win(title, text):
def notify_darwin(title, text):
- import Foundation
- import objc
+ try:
+ import Foundation
+ import objc
- NSUserNotification = objc.lookUpClass("NSUserNotification")
- NSUserNotificationCenter = objc.lookUpClass("NSUserNotificationCenter")
+ NSUserNotification = objc.lookUpClass("NSUserNotification")
+ NSUserNotificationCenter = objc.lookUpClass("NSUserNotificationCenter")
- note = NSUserNotification.alloc().init()
- note.setTitle_(title)
- note.setInformativeText_(text)
+ note = NSUserNotification.alloc().init()
+ note.setTitle_(title)
+ note.setInformativeText_(text)
- now = Foundation.NSDate.dateWithTimeInterval_sinceDate_(0, Foundation.NSDate.date())
- note.setDeliveryDate_(now)
+ now = Foundation.NSDate.dateWithTimeInterval_sinceDate_(0, Foundation.NSDate.date())
+ note.setDeliveryDate_(now)
- centre = NSUserNotificationCenter.defaultUserNotificationCenter()
- centre.scheduleNotification_(note)
+ centre = NSUserNotificationCenter.defaultUserNotificationCenter()
+ centre.scheduleNotification_(note)
+ except ImportError:
+ raise Exception("Please make sure that the Python pyobjc module is installed!")
def notify_build_done(elapsed):