From 8b370958dd0491acfc1a5bcfa984d97e723fed53 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 16 Feb 2025 16:51:40 +0000 Subject: [PATCH] python: Use context to initialize Pakfire Signed-off-by: Michael Tremer --- src/python/__init__.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/python/__init__.py b/src/python/__init__.py index 84d8908..1c2d2a0 100644 --- a/src/python/__init__.py +++ b/src/python/__init__.py @@ -20,14 +20,13 @@ import logging import os +import pakfire import shlex import subprocess import sys import tempfile import traceback -import pakfire - from . import bootloaders from . import disk from . import i18n @@ -329,8 +328,22 @@ class Bricklayer(object): """ Calls Pakfire and has it load its configuration """ - return pakfire.Pakfire(self.root, arch=self.arch, - conf=self.pakfire_conf, **kwargs) + logger = log.getChild("pakfire") + + # Create a new context + ctx = pakfire.Ctx() + + # Configure the logger + ctx.set_logger(logger) + + # Create a new pakfire instance + return pakfire.Pakfire( + ctx = ctx, + path = self.root, + arch = self.arch, + config = self.pakfire_conf, + **kwargs, + ) def _select_bootloaders(self): """ -- 2.47.3