aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2020-02-11 16:56:57 -0800
committerZhizhou Yang <zhizhouy@google.com>2020-02-13 06:50:19 +0000
commit43c9066b1889baaa0a6077399deb6a4d503551e6 (patch)
treedb4575b4aea577e3da2d7bfb3ac17f386b257733 /compiler_wrapper
parentc4615d189f6b0dc4c116fc0a78ac295f7427170e (diff)
downloadtoolchain-utils-43c9066b1889baaa0a6077399deb6a4d503551e6.tar.gz
toolchain-utils: migrate all in-use projects to python 3
This patch migrates all in-use projects left to python 3. BUG=chromium:1011676 TEST=Passed unittests and launched scripts manually. Change-Id: I7f2de4e1131c05bacfac80667f3064da8adaebfd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2051397 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Zhizhou Yang <zhizhouy@google.com> Auto-Submit: Zhizhou Yang <zhizhouy@google.com>
Diffstat (limited to 'compiler_wrapper')
-rwxr-xr-xcompiler_wrapper/build.py4
-rwxr-xr-xcompiler_wrapper/bundle.py15
2 files changed, 10 insertions, 9 deletions
diff --git a/compiler_wrapper/build.py b/compiler_wrapper/build.py
index 6b647714..4257abfc 100755
--- a/compiler_wrapper/build.py
+++ b/compiler_wrapper/build.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -52,7 +52,7 @@ def read_version(build_dir):
return r.read()
last_commit_msg = subprocess.check_output(
- ['git', '-C', build_dir, 'log', '-1', '--pretty=%B'])
+ ['git', '-C', build_dir, 'log', '-1', '--pretty=%B'], encoding='utf-8')
# Use last found change id to support reverts as well.
change_ids = re.findall(r'Change-Id: (\w+)', last_commit_msg)
if not change_ids:
diff --git a/compiler_wrapper/bundle.py b/compiler_wrapper/bundle.py
index c1fa53e0..173625f4 100755
--- a/compiler_wrapper/bundle.py
+++ b/compiler_wrapper/bundle.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -32,7 +32,7 @@ def copy_files(input_dir, output_dir):
def read_change_id(input_dir):
last_commit_msg = subprocess.check_output(
- ['git', '-C', input_dir, 'log', '-1', '--pretty=%B'])
+ ['git', '-C', input_dir, 'log', '-1', '--pretty=%B'], encoding='utf-8')
# Use last found change id to support reverts as well.
change_ids = re.findall(r'Change-Id: (\w+)', last_commit_msg)
if not change_ids:
@@ -41,14 +41,15 @@ def read_change_id(input_dir):
def write_readme(input_dir, output_dir, change_id):
- with open(os.path.join(input_dir, 'bundle.README'), 'r') as r, \
- open(os.path.join(output_dir, 'README'), 'w') as w:
- content = r.read()
- w.write(content.format(change_id=change_id))
+ with open(
+ os.path.join(input_dir, 'bundle.README'), 'r', encoding='utf-8') as r:
+ with open(os.path.join(output_dir, 'README'), 'w', encoding='utf-8') as w:
+ content = r.read()
+ w.write(content.format(change_id=change_id))
def write_version(output_dir, change_id):
- with open(os.path.join(output_dir, 'VERSION'), 'w') as w:
+ with open(os.path.join(output_dir, 'VERSION'), 'w', encoding='utf-8') as w:
w.write(change_id)