aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-09-27 07:35:50 -0600
committerbors-servo <metajack+bors@gmail.com>2015-09-27 07:35:50 -0600
commita1fb8cfbb0be8d0a73bc1e3b63eb704f48098b8f (patch)
tree7943c1657ff46dd6d94cde09a35f9327c64f19c4
parent599fd0094b1a5c43992092ae1ff20a2fa02db559 (diff)
parentb6bbd754791d519316576c62daf1e9ff62e2756d (diff)
downloadservo-a1fb8cfbb0be8d0a73bc1e3b63eb704f48098b8f.tar.gz
servo-a1fb8cfbb0be8d0a73bc1e3b63eb704f48098b8f.zip
Auto merge of #7752 - tamird:fix-osx-notifications, r=nox
mach: fix OS X notifications Since mach now puts everything into a virtualenv, we need to set the bundle identifier to allow sending notifications. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7752) <!-- Reviewable:end -->
-rw-r--r--python/servo/build_commands.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 73d9b9046fa..d7ae9cd5f0e 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -66,19 +66,20 @@ def notify_win(title, text):
def notify_darwin(title, text):
try:
import Foundation
- import objc
- NSUserNotification = objc.lookUpClass("NSUserNotification")
- NSUserNotificationCenter = objc.lookUpClass("NSUserNotificationCenter")
+ bundleDict = Foundation.NSBundle.mainBundle().infoDictionary()
+ bundleIdentifier = 'CFBundleIdentifier'
+ if bundleIdentifier not in bundleDict:
+ bundleDict[bundleIdentifier] = 'mach'
- note = NSUserNotification.alloc().init()
+ note = Foundation.NSUserNotification.alloc().init()
note.setTitle_(title)
note.setInformativeText_(text)
now = Foundation.NSDate.dateWithTimeInterval_sinceDate_(0, Foundation.NSDate.date())
note.setDeliveryDate_(now)
- centre = NSUserNotificationCenter.defaultUserNotificationCenter()
+ centre = Foundation.NSUserNotificationCenter.defaultUserNotificationCenter()
centre.scheduleNotification_(note)
except ImportError:
raise Exception("Please make sure that the Python pyobjc module is installed!")