[elbe-devel] [PATCH 2/6] elbepack: finetuning: reduce scope of apt imports

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jan 27 09:59:16 CET 2025


These import pull in python-apt, which is not present everywhere.
To make the future unittests of finetuning.py more easy to run,
remove the global dependency on python-apt.
These dependencies are only necessary for the very rarely used
"<updated>" finetuning anyways.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/finetuning.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index dfe584c7c84787e4f9b67f7cad2474eb1eedaea4..63b1b61013e2089d71eb1bfd6fe39fb54e50f4ce 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -10,8 +10,6 @@ import shlex
 import subprocess
 from shutil import rmtree
 
-from apt.package import FetchError
-
 from gpg import core
 from gpg.constants import PROTOCOL_OpenPGP
 
@@ -19,8 +17,6 @@ from elbepack.egpg import unlock_key
 from elbepack.filesystem import Filesystem
 from elbepack.imgutils import losetup, mount
 from elbepack.packers import default_packer, packers
-from elbepack.repomanager import UpdateRepo
-from elbepack.rpcaptcache import get_rpcaptcache
 from elbepack.shellhelper import chroot, do
 from elbepack.treeutils import strip_leading_whitespace_from_lines
 
@@ -350,6 +346,9 @@ class PurgeAction(FinetuningAction):
 class UpdatedAction(FinetuningAction):
 
     def execute(self, buildenv, target):
+        from apt.package import FetchError
+        from elbepack.repomanager import UpdateRepo
+        from elbepack.rpcaptcache import get_rpcaptcache
 
         if self.node.et.text:
             fp = self.node.et.text

-- 
2.48.1



More information about the elbe-devel mailing list