[wic][PATCH] wic: Standardize on percent-style formatting in exceptions

Gaël PORTAY <[email protected]> Wed, 15 Jul 2026 00:12:48 +0200
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
Switch from lazy formatting with exception arguments (WicError("string
%s", var)) to immediate percent operator formatting (WicError("string
%s" % var)) for consistency across the codebase.

This ensures unified string formatting style throughout the project.

Signed-off-by: Gaël PORTAY <[email protected]>
---
Dear Maintainers,

I made a diff between few plugins, and I figured out that they share
code with few differences.

I made those two changes to reduce these differences with WicError. The
raise of exceptions in the project uses the immediate percent operator
formatting, thus, in the interest of consistency, I switch the lazy
formatting forms to unify formatting style.

Note: There are also differences with logging (83 more lines), and I
have not tested them yet. I may post them if you are interrested in this
unification, so you can make a review.

Regards,
Gaël
 src/wic/plugins/source/bootimg_efi.py        | 2 +-
 src/wic/plugins/source/isoimage_isohybrid.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wic/plugins/source/bootimg_efi.py b/src/wic/plugins/source/bootimg_efi.py
index fe6c222..7cdd444 100644
--- a/src/wic/plugins/source/bootimg_efi.py
+++ b/src/wic/plugins/source/bootimg_efi.py
@@ -171,7 +171,7 @@ class BootimgEFIPlugin(SourcePlugin):
                              "%s for systemd-boots's boot.conf", configfile)
             else:
                 raise WicError("configfile is specified but failed to "
-                               "get it from %s.", configfile)
+                               "get it from %s." % configfile)
         else:
             # Create systemd-boot configuration using parameters from wks file
             kernel = get_bitbake_var("KERNEL_IMAGETYPE")
diff --git a/src/wic/plugins/source/isoimage_isohybrid.py b/src/wic/plugins/source/isoimage_isohybrid.py
index 0a3ecd3..15dae01 100644
--- a/src/wic/plugins/source/isoimage_isohybrid.py
+++ b/src/wic/plugins/source/isoimage_isohybrid.py
@@ -101,7 +101,7 @@ class IsoImagePlugin(SourcePlugin):
                              configfile)
             else:
                 raise WicError("configfile is specified "
-                               "but failed to get it from %s", configfile)
+                               "but failed to get it from %s" % configfile)
         else:
             splash = os.path.join(target_dir, "splash.jpg")
             if os.path.exists(splash):
-- 
2.43.0