From 0a1f8216601fa9668ea2ca44e50fbb7d69c175a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Tue, 23 Mar 2021 22:22:39 +0000 Subject: [PATCH] Can't create apt object :( --- ognibuild/debian/build_deps.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ognibuild/debian/build_deps.py b/ognibuild/debian/build_deps.py index a39ef50..e4ef97c 100644 --- a/ognibuild/debian/build_deps.py +++ b/ognibuild/debian/build_deps.py @@ -21,10 +21,7 @@ class BuildDependencyTieBreaker(object): def __init__(self, rootdir): - import apt_pkg - apt_pkg.init() - apt_pkg.config.set('Dir', rootdir) - self._apt_cache = apt_pkg.SourceRecords() + self.rootdir = rootdir self._counts = None @classmethod @@ -33,10 +30,14 @@ class BuildDependencyTieBreaker(object): def _count(self): counts = {} - self._apt_cache.restart() - while self._apt_cache.step(): + import apt_pkg + apt_pkg.init() + apt_pkg.config.set('Dir', self.rootdir) + apt_cache = apt_pkg.SourceRecords() + apt_cache.restart() + while apt_cache.step(): try: - for d in self._apt_cache.build_depends.values(): + for d in apt_cache.build_depends.values(): for o in d: for p in o: counts.setdefault(p[0], 0)