notify: catch RuntimeError when importing pynotify
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 12 Jun 2014 09:04:09 +0000 (12:04 +0300)
committerGuido Günther <agx@sigxcpu.org>
Fri, 5 Dec 2014 14:52:19 +0000 (15:52 +0100)
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 95c4bf41131fa98f896fbe385890703b9ba6c878..9d9071a9f0ea0a91bfb450f6a4e71d063975d2e3 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")