aboutsummaryrefslogtreecommitdiff
path: root/cros_utils/command_executer.py
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2020-02-13 17:52:03 +0000
committerCommit Bot <commit-bot@chromium.org>2020-02-14 00:00:40 +0000
commit8f1457d991b2da1ed26d0359a888995f3d761432 (patch)
tree0f7c408e85f1d8a063e33ebc14bce3ddab2c536e /cros_utils/command_executer.py
parent22e3075e965be294d2b080752a113788c3cf136a (diff)
downloadtoolchain-utils-8f1457d991b2da1ed26d0359a888995f3d761432.tar.gz
Revert "cros_utils: Do not use encoding in NamedTemporaryFile"
This reverts commit e013418dade906a2828b33fcb6432010953de847. Reason for revert: All dependencies of cros_utils have been migrated to python3. Original change's description: > 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> Bug: chromium:1048938, chromium:1048884 Change-Id: Iff7d1e7ff1c0e843602192a3152a29d0f62073d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2054075 Reviewed-by: Zhizhou Yang <zhizhouy@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Zhizhou Yang <zhizhouy@google.com> Tested-by: Zhizhou Yang <zhizhouy@google.com> Auto-Submit: Zhizhou Yang <zhizhouy@google.com>
Diffstat (limited to 'cros_utils/command_executer.py')
-rwxr-xr-xcros_utils/command_executer.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/cros_utils/command_executer.py b/cros_utils/command_executer.py
index 39bff5ed..002aa754 100755
--- a/cros_utils/command_executer.py
+++ b/cros_utils/command_executer.py
@@ -240,10 +240,9 @@ 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', delete=False, prefix=os.uname()[1], suffix='.sh') as f:
+ 'w', encoding='utf-8', delete=False, prefix=os.uname()[1],
+ suffix='.sh') as f:
f.write('#!/bin/bash\n')
f.write(contents)
f.flush()
@@ -367,10 +366,9 @@ 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',