From d5e35c9dda7fcaf479cf91a49661c345c93a025c Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Mon, 18 Nov 2019 23:56:08 +1100 Subject: [PATCH] repopick: fix --check-picked on Python 3 This is very subtly broken: we look for the string 'Change-Id:' in an array of byte strings. Fix this by decoding the git output to utf-8 strings. Change-Id: I708ad0adacb61c89bfba0fd88eeb2e37648317af --- build/tools/repopick.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/tools/repopick.py b/build/tools/repopick.py index bf27d1d8..95aabfce 100755 --- a/build/tools/repopick.py +++ b/build/tools/repopick.py @@ -392,7 +392,11 @@ if __name__ == '__main__': for i in range(0, check_picked_count): if subprocess.call(['git', 'cat-file', '-e', 'HEAD~{0}'.format(i)], cwd=project_path, stderr=open(os.devnull, 'wb')): continue - output = subprocess.check_output(['git', 'show', '-q', 'HEAD~{0}'.format(i)], cwd=project_path).split() + output = subprocess.check_output(['git', 'show', '-q', 'HEAD~{0}'.format(i)], cwd=project_path) + # make sure we have a string on Python 3 + if isinstance(output, bytes): + output = output.decode('utf-8') + output = output.split() if 'Change-Id:' in output: head_change_id = '' for j,t in enumerate(reversed(output)):