From fe2d6022409248063403eed2f2de97f438dc7f03 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 14 Feb 2017 18:54:32 +0200 Subject: wic: use wic logger in core modules Replaced msger with wic logger in the core wic modules. (From OE-Core rev: cdd6675951b74075c9b9159f7465a88f83775bac) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- scripts/lib/wic/engine.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'scripts/lib/wic/engine.py') diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 1aa8f6534e..b64714c686 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -28,6 +28,7 @@ # Tom Zanussi # +import logging import os import sys @@ -35,6 +36,7 @@ from wic import msger from wic.plugin import pluginmgr from wic.utils.misc import get_bitbake_var +logger = logging.getLogger('wic') def verify_build_env(): """ @@ -43,7 +45,7 @@ def verify_build_env(): Returns True if it is, false otherwise """ if not os.environ.get("BUILDDIR"): - print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") + logger.error("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") sys.exit(1) return True @@ -179,7 +181,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, try: oe_builddir = os.environ["BUILDDIR"] except KeyError: - print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") + logger.error("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") sys.exit(1) if options.debug: @@ -191,14 +193,15 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, pname = 'direct' plugin_class = pluginmgr.get_plugins('imager').get(pname) if not plugin_class: - msger.error('Unknown plugin: %s' % pname) + logger.error('Unknown plugin: %s', pname) + sys.exit(1) plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir, native_sysroot, oe_builddir, options) plugin.do_create() - print("\nThe image(s) were created using OE kickstart file:\n %s" % wks_file) + logger.info("The image(s) were created using OE kickstart file:\n %s", wks_file) def wic_list(args, scripts_path): @@ -218,10 +221,10 @@ def wic_list(args, scripts_path): wks_file = args[0] fullpath = find_canned_image(scripts_path, wks_file) if not fullpath: - print("No image named %s found, exiting. "\ - "(Use 'wic list images' to list available images, or "\ - "specify a fully-qualified OE kickstart (.wks) "\ - "filename)\n" % wks_file) + logger.error("No image named %s found, exiting. " + "(Use 'wic list images' to list available images, or " + "specify a fully-qualified OE kickstart (.wks) " + "filename)\n", wks_file) sys.exit(1) list_canned_image_help(scripts_path, fullpath) return True -- cgit v1.2.3-54-g00ecf