[elbe-devel] [PATCH 18/18] elbepack: move run_elbe_subcommand() to elbepack.main
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Aug 13 13:15:48 CEST 2024
This function only lives in directories.py for historical reasons.
It better fits into main.py.
After moving the function, directories.py is completely empty and can be
removed, do that, too.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
debian/python3-elbe-common.install | 1 -
elbepack/commands/check-build.py | 2 +-
elbepack/directories.py | 13 -------------
elbepack/main.py | 7 +++++++
elbepack/tests/cyclonedx/test_cyclonedx_sbom.py | 2 +-
elbepack/tests/test_parselicence.py | 2 +-
elbepack/tests/test_preproc.py | 2 +-
elbepack/tests/test_validate.py | 2 +-
elbepack/tests/test_xml.py | 2 +-
9 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/debian/python3-elbe-common.install b/debian/python3-elbe-common.install
index 092424a511b1..89d607b76ca2 100644
--- a/debian/python3-elbe-common.install
+++ b/debian/python3-elbe-common.install
@@ -16,7 +16,6 @@ usr/lib/python3.*/*-packages/elbepack/cli.py
usr/lib/python3.*/*-packages/elbepack/config.py
usr/lib/python3.*/*-packages/elbepack/debinstaller.py
usr/lib/python3.*/*-packages/elbepack/default-preseed.xml
-usr/lib/python3.*/*-packages/elbepack/directories.py
usr/lib/python3.*/*-packages/elbepack/efilesystem.py
usr/lib/python3.*/*-packages/elbepack/elbexml.py
usr/lib/python3.*/*-packages/elbepack/elbeproject.py
diff --git a/elbepack/commands/check-build.py b/elbepack/commands/check-build.py
index df59e0fb5ec6..ebf81a6dc4cd 100644
--- a/elbepack/commands/check-build.py
+++ b/elbepack/commands/check-build.py
@@ -16,9 +16,9 @@ import pexpect
from elbepack import qemu_firmware
from elbepack.aptpkgutils import parse_built_using
-from elbepack.directories import run_elbe_subcommand
from elbepack.filesystem import TmpdirFilesystem
from elbepack.log import elbe_logging
+from elbepack.main import run_elbe_subcommand
from elbepack.shellhelper import env_add
from elbepack.treeutils import etree
from elbepack.version import is_devel
diff --git a/elbepack/directories.py b/elbepack/directories.py
deleted file mode 100644
index 45061a54c7eb..000000000000
--- a/elbepack/directories.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# ELBE - Debian Based Embedded Rootfilesystem Builder
-# SPDX-License-Identifier: GPL-3.0-or-later
-# SPDX-FileCopyrightText: 2015, 2017 Linutronix GmbH
-
-import os
-
-import elbepack.main
-
-
-def run_elbe_subcommand(args):
- return elbepack.main.main([
- 'elbe', '--propagate-exception', *[os.fspath(arg) for arg in args],
- ])
diff --git a/elbepack/main.py b/elbepack/main.py
index 4bfd248b02d0..50945ee35553 100644
--- a/elbepack/main.py
+++ b/elbepack/main.py
@@ -4,6 +4,7 @@
import argparse
import importlib
+import os
import pkgutil
import sys
@@ -40,3 +41,9 @@ def main(argv=sys.argv):
sys.exit(format_exception(e, output=sys.stderr,
base_module=elbepack,
verbose=args.stacktrace_on_error))
+
+
+def run_elbe_subcommand(args):
+ return main([
+ 'elbe', '--propagate-exception', *[os.fspath(arg) for arg in args],
+ ])
diff --git a/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py b/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
index 37df25b703c2..f77369be9c76 100644
--- a/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
+++ b/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
@@ -10,7 +10,7 @@ import uuid
import jsonschema
-from elbepack.directories import run_elbe_subcommand
+from elbepack.main import run_elbe_subcommand
here = pathlib.Path(__file__).parent
diff --git a/elbepack/tests/test_parselicence.py b/elbepack/tests/test_parselicence.py
index 6238291cf05b..3be19893c0d2 100644
--- a/elbepack/tests/test_parselicence.py
+++ b/elbepack/tests/test_parselicence.py
@@ -7,7 +7,7 @@ import io
import pathlib
import re
-from elbepack.directories import run_elbe_subcommand
+from elbepack.main import run_elbe_subcommand
here = pathlib.Path(__file__).parent
diff --git a/elbepack/tests/test_preproc.py b/elbepack/tests/test_preproc.py
index cd7a99e89150..7cbdaa71c494 100644
--- a/elbepack/tests/test_preproc.py
+++ b/elbepack/tests/test_preproc.py
@@ -7,7 +7,7 @@ import tarfile
import pytest
-from elbepack.directories import run_elbe_subcommand
+from elbepack.main import run_elbe_subcommand
def _test_file_path(name):
diff --git a/elbepack/tests/test_validate.py b/elbepack/tests/test_validate.py
index 9a0260118c2e..20c0238836e2 100644
--- a/elbepack/tests/test_validate.py
+++ b/elbepack/tests/test_validate.py
@@ -7,7 +7,7 @@ import os
import pytest
-from elbepack.directories import run_elbe_subcommand
+from elbepack.main import run_elbe_subcommand
def _test_cases():
diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
index 203e665d73db..1781a3e16f68 100644
--- a/elbepack/tests/test_xml.py
+++ b/elbepack/tests/test_xml.py
@@ -10,7 +10,7 @@ import subprocess
import pytest
-from elbepack.directories import run_elbe_subcommand
+from elbepack.main import run_elbe_subcommand
from elbepack.tests import parametrize_xml_test_files, xml_test_files
--
2.46.0
More information about the elbe-devel
mailing list