[elbe-devel] [PATCH v4 12/41] Add logging to stdout for command toolchainextract

dion at linutronix.de dion at linutronix.de
Mon Jul 8 17:11:17 CEST 2019


From: Olivier Dion <dion at linutronix.de>

make use of the new logging system, and replace all print() with
functions from logging and wrap it in
"with elbe_logging({"streams":sys.stdout}):"

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/commands/toolchainextract.py | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/elbepack/commands/toolchainextract.py b/elbepack/commands/toolchainextract.py
index aaf26ac2..a1a4757a 100644
--- a/elbepack/commands/toolchainextract.py
+++ b/elbepack/commands/toolchainextract.py
@@ -8,12 +8,13 @@ from optparse import OptionParser
 from tempfile import mkdtemp
 
 import os
+import sys
 
 from elbepack.xmldefaults import ElbeDefaults
 from elbepack.repomanager import ToolchainRepo
 from elbepack.debpkg import build_binary_deb
 from elbepack.toolchain import get_toolchain
-from elbepack.asciidoclog import StdoutLog
+from elbepack.log import elbe_logging
 
 
 def run_command(argv):
@@ -68,14 +69,16 @@ def run_command(argv):
 
     pkgs = os.listdir(tmpdir)
 
-    repo = ToolchainRepo(
-        defaults["arch"],
-        opt.codename,
-        opt.output,
-        StdoutLog())
+    with elbe_logging({"streams":sys.stdout}):
 
-    for p in pkgs:
-        repo.includedeb(os.path.join(tmpdir, p))
+        repo = ToolchainRepo(
+            defaults["arch"],
+            opt.codename,
+            opt.output,
+            StdoutLog())
+
+        for p in pkgs:
+            repo.includedeb(os.path.join(tmpdir, p))
 
-    repo.finalize()
-    os.system('rm -r "%s"' % tmpdir)
+        repo.finalize()
+        os.system('rm -r "%s"' % tmpdir)
-- 
2.11.0




More information about the elbe-devel mailing list