[U-Boot] [PATCH] patman: Fix cc-cmd option for Python 3

Simon Glass sjg at chromium.org
Thu Nov 7 16:14:29 UTC 2019


The Python 3 conversion doesn't work correctly with the new patch to use
NUL as the separator in the CC file.

Fix this by avoiding encoding the CC list written to the file.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/patman/patman.py | 2 +-
 tools/patman/series.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/patman/patman.py b/tools/patman/patman.py
index cf53e532dd..ca209c276d 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -107,7 +107,7 @@ elif options.test:
 # Called from git with a patch filename as argument
 # Printout a list of additional CC recipients for this patch
 elif options.cc_cmd:
-    fd = open(options.cc_cmd, 'r')
+    fd = open(options.cc_cmd, 'r', encoding='utf-8')
     re_line = re.compile('(\S*) (.*)')
     for line in fd.readlines():
         match = re_line.match(line)
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 02a1113ad0..a15f7625ed 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -251,7 +251,7 @@ class Series(dict):
             cover_cc = [tools.FromUnicode(m) for m in cover_cc]
             cc_list = '\0'.join([tools.ToUnicode(x)
                                  for x in sorted(set(cover_cc + all_ccs))])
-            print(cover_fname, cc_list.encode('utf-8'), file=fd)
+            print(cover_fname, cc_list, file=fd)
 
         fd.close()
         return fname
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog



More information about the U-Boot mailing list