Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.

Commit fe104cf

Browse files
committed
Adapt to the new dnf API
Requestd by us actually, see rpm-software-management/dnf#842
1 parent c9588f2 commit fe104cf

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

taskotron_python_versions/requires.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,18 @@ def get_packages_by(self, **kwargs):
3838
"""
3939
try:
4040
return self.query.filter(**kwargs).run()
41-
except AttributeError:
41+
except AttributeError as ae:
42+
log.debug(repr(ae))
4243
return []
4344

4445
@staticmethod
4546
def add_repo(base, reponame, repourl):
46-
try:
47-
# Fedora 26
48-
repo = dnf.repo.Repo(reponame, parent_conf=base.conf)
49-
except TypeError:
50-
# Fedora 25
51-
repo = dnf.repo.Repo(reponame, cachedir=base.conf.cachedir)
52-
5347
metalink = ('https://mirrors.fedoraproject.org/'
5448
'metalink?repo={}&arch=$basearch'.format(repourl))
55-
repo.metalink = dnf.conf.parser.substitute(metalink,
56-
base.conf.substitutions)
57-
58-
base.repos.add(repo)
59-
repo.skip_if_unavailable = False
49+
repo = base.repos.add_new_repo(reponame,
50+
base.conf,
51+
metalink=metalink,
52+
skip_if_unavailable=False)
6053
repo.enable()
6154
repo.load()
6255
return repo

0 commit comments

Comments
 (0)