diff options
author | Zhizhou Yang <zhizhouy@google.com> | 2020-02-11 16:56:57 -0800 |
---|---|---|
committer | Zhizhou Yang <zhizhouy@google.com> | 2020-02-13 06:50:19 +0000 |
commit | 43c9066b1889baaa0a6077399deb6a4d503551e6 (patch) | |
tree | db4575b4aea577e3da2d7bfb3ac17f386b257733 /pgo_tools | |
parent | c4615d189f6b0dc4c116fc0a78ac295f7427170e (diff) | |
download | toolchain-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 'pgo_tools')
-rwxr-xr-x | pgo_tools/merge_profdata_and_upload.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pgo_tools/merge_profdata_and_upload.py b/pgo_tools/merge_profdata_and_upload.py index dddc7f1e..ea95289b 100755 --- a/pgo_tools/merge_profdata_and_upload.py +++ b/pgo_tools/merge_profdata_and_upload.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 @@ -56,7 +56,8 @@ _LLVMMetadata = collections.namedtuple('_LLVMMetadata', ['head_sha']) def _get_gs_latest(remote_lastest): assert remote_lastest.startswith(_GS_PREFIX) try: - return subprocess.check_output(['gsutil', 'cat', remote_lastest]) + return subprocess.check_output(['gsutil', 'cat', remote_lastest], + encoding='utf-8') except subprocess.CalledProcessError: raise RuntimeError('Lastest artifacts not found: %s' % remote_lastest) @@ -142,7 +143,8 @@ def _tar_and_upload_profdata(profdata, name_suffix): print('Uploading tarball to gs.\nCMD: %s\n' % upload_cmd) # gsutil prints all status to stderr, oddly enough. - gs_output = subprocess.check_output(upload_cmd, stderr=subprocess.STDOUT) + gs_output = subprocess.check_output( + upload_cmd, stderr=subprocess.STDOUT, encoding='utf-8') print(gs_output) # gsutil exits successfully even if it uploaded nothing. It prints a summary @@ -227,7 +229,7 @@ def main(): for tryjob in args.tryjob: fetch_and_append_artifacts(tryjob) - assert heads, 'Didn\'t fetch anything?' + assert heads, "Didn't fetch anything?" def die_with_head_complaint(complaint): extra = ' (HEADs found: %s)' % sorted(heads) @@ -239,7 +241,7 @@ def main(): die_with_head_complaint( '%d LLVM HEADs were found, which is more than one. You probably ' 'want a consistent set of HEADs for a profile. If you know you ' - 'don\'t, please specify --llvm_hash, and note that *all* profiles ' + "don't, please specify --llvm_hash, and note that *all* profiles " 'will be merged into this final profile, regardless of their ' 'reported HEAD.' % len(heads)) llvm_hash, = heads @@ -247,7 +249,7 @@ def main(): if llvm_hash not in heads: assert llvm_hash == args.llvm_hash die_with_head_complaint( - 'HEAD %s wasn\'t found in any fetched artifacts.' % llvm_hash) + "HEAD %s wasn't found in any fetched artifacts." % llvm_hash) print('Using LLVM hash: %s' % llvm_hash) |