From 654da7cb03f3e976d603e898f16e69f381860085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 16 Oct 2017 01:29:12 +0200 Subject: [PATCH] Drop log.DBusHandler Packages had missing dependency on python-dbus. Since DBusHandler isn't used anywhere, drop it, instead of introducing more dependencies. Reported by @pietrushnic QubesOS/qubes-issues#3179 --- qubesadmin/log.py | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/qubesadmin/log.py b/qubesadmin/log.py index 01bce9c..a06a212 100644 --- a/qubesadmin/log.py +++ b/qubesadmin/log.py @@ -27,8 +27,6 @@ See also: :py:attr:`qubes.vm.qubesvm.QubesVM.log` import logging import sys -import dbus - FORMAT_CONSOLE = '%(name)s: %(message)s' FORMAT_LOG = '%(asctime)s %(message)s' FORMAT_DEBUG = '%(asctime)s ' \ @@ -39,43 +37,6 @@ formatter_log = logging.Formatter(FORMAT_LOG) formatter_debug = logging.Formatter(FORMAT_DEBUG) -class DBusHandler(logging.Handler): - '''Handler which displays records as DBus notifications''' - - #: mapping of loglevels to icons - app_icons = { - logging.ERROR: 'dialog-error', - logging.WARNING: 'dialog-warning', - logging.NOTSET: 'dialog-information', - } - - def __init__(self, *args, **kwargs): - super(DBusHandler, self).__init__(*args, **kwargs) - - self._notify_object = dbus.SessionBus().get_object( - 'org.freedesktop.Notifications', '/org/freedesktop/Notifications') - - - def emit(self, record): - app_icon = self.app_icons[ - max(level for level in self.app_icons if level <= record.levelno)] - - try: - # https://developer.gnome.org/notification-spec/#command-notify - self._notify_object.Notify( - 'Qubes', # STRING app_name - 0, # UINT32 replaces_id - app_icon, # STRING app_icon - record.msg, # STRING summary - '', # STRING body - (), # ARRAY actions - {}, # DICT hints - 0, # INT32 timeout - dbus_interface='org.freedesktop.Notifications') - except dbus.DBusException: - pass - - def enable(): '''Enable global logging