dnf-qubes-hooks: handle newer DNF >= 2.x

This commit is contained in:
Frédéric Pierret 2017-09-24 12:20:12 +02:00
parent abb6d23470
commit cb2448f1ab
No known key found for this signature in database
GPG Key ID: 1DABC232BE02201E

View File

@ -20,8 +20,10 @@
# #
from __future__ import absolute_import from __future__ import absolute_import
from distutils.version import LooseVersion
import logging import logging
import dnf import dnf
import dnf.const
import subprocess import subprocess
PLUGIN_CONF = 'qubes-hooks' PLUGIN_CONF = 'qubes-hooks'
@ -35,7 +37,10 @@ class QubesHooks(dnf.Plugin):
self.log = logging.getLogger('dnf') self.log = logging.getLogger('dnf')
def transaction(self): def transaction(self):
if LooseVersion(dnf.const.VERSION) < '2.0.0':
config = self.read_config(self.base.conf, PLUGIN_CONF) config = self.read_config(self.base.conf, PLUGIN_CONF)
else:
config = self.read_config(self.base.conf)
if config.getboolean('main', 'notify-updates'): if config.getboolean('main', 'notify-updates'):
# Get all updates available _before_ this transaction # Get all updates available _before_ this transaction