From 7be822d6e9a0aade683347bd338780ed357d5509 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Wed, 12 Mar 2025 16:08:38 +0100 Subject: [PATCH] stages/rpm: set encoding for subprocess.run() Printing 'owner' in an fstring triggers the mypy warning 'str-bytes-safe' Error: If x = b'abc' then f"{x}" or "{}".format(x) produces "b'abc'", not "abc". We can't yet use the nicer run() argument, 'text=True', because we still target the RHEL 7 build root which only has Python 3.6 and 'text' was introduced in Python 3.7. --- stages/org.osbuild.rpm | 1 + 1 file changed, 1 insertion(+) diff --git a/stages/org.osbuild.rpm b/stages/org.osbuild.rpm index 31e55f80..a667245c 100755 --- a/stages/org.osbuild.rpm +++ b/stages/org.osbuild.rpm @@ -112,6 +112,7 @@ def remove_unowned_etc_kernel(tree, rpm_args): "--root", tree, "-qf", "/etc/kernel"], stdout=subprocess.PIPE, + encoding="utf-8", check=False) owner = res.stdout.strip()