notify: catch RuntimeError when importing pynotify
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 12 Jun 2014 09:04:09 +0000 (12:04 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 14 Nov 2014 12:21:38 +0000 (14:21 +0200)
Work around a problem in some distros (e.g. Fedora) where "import
pynotify" crashes in RuntimeError in some cases, e.g. when DISPLAY env
variable is not set.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/notifications.py

index 95c4bf4..9d9071a 100644 (file)
@@ -28,7 +28,7 @@ def enable_notifications():
         try:
             import pynotify
             notify_module = pynotify
-        except ImportError:
+        except (ImportError, RuntimeError):
             return False
 
     return notify_module.init("git-buildpackage")