aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2020-02-04 16:45:13 -0800
committerZhizhou Yang <zhizhouy@google.com>2020-02-05 02:21:40 +0000
commite013418dade906a2828b33fcb6432010953de847 (patch)
tree54766a41f89ec953534eeae68e6e3b502756521e
parent360774425d0160d12cbf49f9f68d021c3967641b (diff)
downloadtoolchain-utils-e013418dade906a2828b33fcb6432010953de847.tar.gz
cros_utils: Do not use encoding in NamedTemporaryFile
This parameter is introduced in python 3 and there are many scripts calling cros_utils with python 2. TEST=passed all unittests. BUG=chromium:1048938, chromium:1048884 Change-Id: If4a8b9f9e9ef5a1720647c7187d7d08e1d6655b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2037144 Reviewed-by: George Burgess <gbiv@chromium.org> Commit-Queue: Zhizhou Yang <zhizhouy@google.com> Tested-by: Zhizhou Yang <zhizhouy@google.com>
-rwxr-xr-xcros_utils/command_executer.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cros_utils/command_executer.py b/cros_utils/command_executer.py
index 002aa754..39bff5ed 100755
--- a/cros_utils/command_executer.py
+++ b/cros_utils/command_executer.py
@@ -240,9 +240,10 @@ class CommandExecuter(object):
return command
def WriteToTempShFile(self, contents):
+ # TODO(crbug.com/1048938): use encoding='utf-8' when all dependencies have
+ # migrated to python 3.
with tempfile.NamedTemporaryFile(
- 'w', encoding='utf-8', delete=False, prefix=os.uname()[1],
- suffix='.sh') as f:
+ 'w', delete=False, prefix=os.uname()[1], suffix='.sh') as f:
f.write('#!/bin/bash\n')
f.write(contents)
f.flush()
@@ -366,9 +367,10 @@ class CommandExecuter(object):
if self.logger:
self.logger.LogCmd(command, print_to_console=print_to_console)
+ # TODO(crbug.com/1048938): use encoding='utf-8' when all dependencies have
+ # migrated to python 3.
with tempfile.NamedTemporaryFile(
'w',
- encoding='utf-8',
delete=False,
dir=os.path.join(chromeos_root, 'src/scripts'),
suffix='.sh',