Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding
@ 2021-11-02 22:20 Thomas Petazzoni
  2021-11-02 22:20 ` [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path Thomas Petazzoni
  2021-11-03 21:15 ` [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Peter Korsgaard
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2021-11-02 22:20 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni

In Python 3.x, check_output() returns a "bytes" array, and not a
string. Its result needs to be decoded to be turned into a
string. Without this fix, "get-developers -c" bails out with:

Traceback (most recent call last):
  File "/home/thomas/projets/buildroot/./utils/get-developers", line 105, in <module>
    __main__()
  File "/home/thomas/projets/buildroot/./utils/get-developers", line 53, in __main__
    files = getdeveloperlib.check_developers(devs)
  File "/home/thomas/projets/buildroot/utils/getdeveloperlib.py", line 280, in check_developers
    files = subprocess.check_output(cmd).strip().split("\n")
TypeError: a bytes-like object is required, not 'str'

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 utils/getdeveloperlib.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/getdeveloperlib.py b/utils/getdeveloperlib.py
index 438d26d68d..f351f05a1f 100644
--- a/utils/getdeveloperlib.py
+++ b/utils/getdeveloperlib.py
@@ -277,7 +277,7 @@ def check_developers(developers, basepath=None):
     if basepath is None:
         basepath = os.getcwd()
     cmd = ["git", "--git-dir", os.path.join(basepath, ".git"), "ls-files"]
-    files = subprocess.check_output(cmd).strip().split("\n")
+    files = subprocess.check_output(cmd).decode(sys.stdout.encoding).strip().split("\n")
     unhandled_files = []
     for f in files:
         handled = False
-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-03 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-02 22:20 [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Thomas Petazzoni
2021-11-02 22:20 ` [Buildroot] [PATCH 2/2] utils/getdeveloperlib.py: call Developer.hasfile() with relative path Thomas Petazzoni
2021-11-03 21:15   ` Peter Korsgaard
2021-11-03 21:15 ` [Buildroot] [PATCH 1/2] utils/getdeveloperlib.py: fix check_output() return value decoding Peter Korsgaard
2021-11-03 21:53   ` Thomas Petazzoni
2021-11-03 22:10     ` Peter Korsgaard
2021-11-03 22:41       ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox