From 8e07fd436cfbf02fbf43c9e221badb55acdb546a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 4 Jul 2008 14:15:55 +0200 Subject: Some more dependency awareness --- plugins/notify.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins/notify.py') diff --git a/plugins/notify.py b/plugins/notify.py index bc1b2ea..6446812 100644 --- a/plugins/notify.py +++ b/plugins/notify.py @@ -10,7 +10,12 @@ # # Written by René 'Necoro' Neumann -import pynotify +disable = False + +try: + import pynotify +except ImportError: + disable = True from portato import get_listener @@ -22,8 +27,7 @@ class Notify (Plugin): __description__ = "Show notifications when an emerge process finishes." __dependency__ = ["dev-python/notify-python"] - def __init__ (self): - Plugin.__init__(self) + def init (self): self.add_call("after_emerge", self.notify) def notify (self, retcode, **kwargs): @@ -42,4 +46,4 @@ class Notify (Plugin): get_listener().send_notify(base = text, descr = descr, icon = icon, urgency = urgency) -register(Notify) +register(Notify, disable) -- cgit v1.2.3