[elbe-devel] [PATCH 06/19] elbepack: drop default_preseed_fname
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Mar 19 08:47:35 CET 2024
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/directories.py | 1 -
elbepack/templates.py | 11 ++++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/elbepack/directories.py b/elbepack/directories.py
index 3786cc0416c0..49bf9d2538f0 100644
--- a/elbepack/directories.py
+++ b/elbepack/directories.py
@@ -22,7 +22,6 @@ def get_cmdlist():
pack_dir = elbepack.__path__[0]
-default_preseed_fname = os.path.join(pack_dir, 'default-preseed.xml')
xsdtoasciidoc_mako_fname = os.path.join(pack_dir, 'xsdtoasciidoc.mako')
diff --git a/elbepack/templates.py b/elbepack/templates.py
index f0018eecc7db..98f2fcacca5c 100644
--- a/elbepack/templates.py
+++ b/elbepack/templates.py
@@ -5,8 +5,8 @@
import importlib.resources
import os
+import elbepack
import elbepack.makofiles
-from elbepack.directories import default_preseed_fname
from elbepack.treeutils import etree
from mako import exceptions
@@ -41,8 +41,13 @@ def write_pack_template(outname, fname, d, linebreak=False):
write_template(outname, template, d, linebreak)
+def _default_preseed():
+ with importlib.resources.files(elbepack) / 'default-preseed.xml' as f:
+ return etree(f)
+
+
def get_preseed(xml):
- def_xml = etree(default_preseed_fname)
+ def_xml = _default_preseed()
preseed = {}
for c in def_xml.node('/preseed'):
@@ -64,7 +69,7 @@ def get_preseed(xml):
def get_initvm_preseed(xml):
- def_xml = etree(default_preseed_fname)
+ def_xml = _default_preseed()
preseed = {}
for c in def_xml.node('/preseed'):
--
2.44.0
More information about the elbe-devel
mailing list