Skip to contentSkip to conversation

patman: Fix cc-cmd option for Python 3

PATCH New Simon Glass 1 participant 1 message Nov 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 patman: Fix cc-cmd option for Python 3

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.

---

 tools/patman/patman.py | 2 +-
 tools/patman/series.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/patman/patman.py +1 -1
index cf53e532dd..ca209c276d 100755
@@ -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)
tools/patman/series.py +1 -1
index 02a1113ad0..a15f7625ed 100644
@@ -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
Signature · 1 line
2.24.0.rc1.363.gb1bccd3e3d-goog