From 2124be5caee6803d5bfe6f7cdc8e3367cb375807 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Thu, 21 Apr 2022 10:27:37 -0700 Subject: toolchain_utils: s/Cr OS/CrOS/g Result of running `sed -ri 's/Chrom(ium|e) OS/Chrom\1OS/g' $(find -type f)`. BUG=None TEST=None Change-Id: I59be92537aa19bc989f52b585e307e76dbde401b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3600147 Reviewed-by: Manoj Gupta Commit-Queue: George Burgess Tested-by: George Burgess --- binary_search_tool/compiler_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'binary_search_tool/compiler_wrapper.py') diff --git a/binary_search_tool/compiler_wrapper.py b/binary_search_tool/compiler_wrapper.py index 0fd92c67..a1dcb1b7 100755 --- a/binary_search_tool/compiler_wrapper.py +++ b/binary_search_tool/compiler_wrapper.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2020 The Chromium OS Authors. All rights reserved. +# Copyright 2020 The ChromiumOS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -- cgit v1.2.3 From 74bd380a27f4f0e8e90ff2dc1cef0b502d74961b Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Fri, 2 Sep 2022 16:59:27 -0700 Subject: Autoformat all Python code This autoformats all Python code with our new Python formatter, `black`. BUG=b:244644217 TEST=None Change-Id: I15ee49233d98fb6295c0c53c129bbf8e78e0d9ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3877337 Tested-by: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Commit-Queue: George Burgess --- binary_search_tool/compiler_wrapper.py | 51 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'binary_search_tool/compiler_wrapper.py') diff --git a/binary_search_tool/compiler_wrapper.py b/binary_search_tool/compiler_wrapper.py index a1dcb1b7..acb7f9eb 100755 --- a/binary_search_tool/compiler_wrapper.py +++ b/binary_search_tool/compiler_wrapper.py @@ -28,41 +28,42 @@ import sys from binary_search_tool import bisect_driver -WRAPPED = '%s.real' % sys.argv[0] -BISECT_STAGE = os.environ.get('BISECT_STAGE') -DEFAULT_BISECT_DIR = os.path.expanduser('~/ANDROID_BISECT') -BISECT_DIR = os.environ.get('BISECT_DIR') or DEFAULT_BISECT_DIR + +WRAPPED = "%s.real" % sys.argv[0] +BISECT_STAGE = os.environ.get("BISECT_STAGE") +DEFAULT_BISECT_DIR = os.path.expanduser("~/ANDROID_BISECT") +BISECT_DIR = os.environ.get("BISECT_DIR") or DEFAULT_BISECT_DIR def ProcessArgFile(arg_file): - args = [] - # Read in entire file at once and parse as if in shell - with open(arg_file, 'r', encoding='utf-8') as f: - args.extend(shlex.split(f.read())) + args = [] + # Read in entire file at once and parse as if in shell + with open(arg_file, "r", encoding="utf-8") as f: + args.extend(shlex.split(f.read())) - return args + return args def Main(_): - if not os.path.islink(sys.argv[0]): - print("Compiler wrapper can't be called directly!") - return 1 + if not os.path.islink(sys.argv[0]): + print("Compiler wrapper can't be called directly!") + return 1 - execargs = [WRAPPED] + sys.argv[1:] + execargs = [WRAPPED] + sys.argv[1:] - if BISECT_STAGE not in bisect_driver.VALID_MODES or '-o' not in execargs: - os.execv(WRAPPED, [WRAPPED] + sys.argv[1:]) + if BISECT_STAGE not in bisect_driver.VALID_MODES or "-o" not in execargs: + os.execv(WRAPPED, [WRAPPED] + sys.argv[1:]) - # Handle @file argument syntax with compiler - for idx, _ in enumerate(execargs): - # @file can be nested in other @file arguments, use While to re-evaluate - # the first argument of the embedded file. - while execargs[idx][0] == '@': - args_in_file = ProcessArgFile(execargs[idx][1:]) - execargs = execargs[0:idx] + args_in_file + execargs[idx + 1:] + # Handle @file argument syntax with compiler + for idx, _ in enumerate(execargs): + # @file can be nested in other @file arguments, use While to re-evaluate + # the first argument of the embedded file. + while execargs[idx][0] == "@": + args_in_file = ProcessArgFile(execargs[idx][1:]) + execargs = execargs[0:idx] + args_in_file + execargs[idx + 1 :] - bisect_driver.bisect_driver(BISECT_STAGE, BISECT_DIR, execargs) + bisect_driver.bisect_driver(BISECT_STAGE, BISECT_DIR, execargs) -if __name__ == '__main__': - sys.exit(Main(sys.argv[1:])) +if __name__ == "__main__": + sys.exit(Main(sys.argv[1:])) -- cgit v1.2.3 From c0041a9550814e402f661a560855ff99863cffb2 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 6 Sep 2022 12:12:02 -0700 Subject: remove `from __future__ import ...` directives These are only useful when we're running code in a Python 2.7 interpreter. Since we no longer support python2, drop these. BUG=b:244644217 TEST=run_tests_for.py shows no new failures Change-Id: Ief9a12b87a560ab38ca71668636874bcb434a0b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3877339 Reviewed-by: Ryan Beltran Commit-Queue: George Burgess Reviewed-by: Jordan Abrahams-Whitehead Tested-by: George Burgess --- binary_search_tool/compiler_wrapper.py | 1 - 1 file changed, 1 deletion(-) (limited to 'binary_search_tool/compiler_wrapper.py') diff --git a/binary_search_tool/compiler_wrapper.py b/binary_search_tool/compiler_wrapper.py index acb7f9eb..02dd332e 100755 --- a/binary_search_tool/compiler_wrapper.py +++ b/binary_search_tool/compiler_wrapper.py @@ -20,7 +20,6 @@ Design doc: https://docs.google.com/document/d/1yDgaUIa2O5w6dc3sSTe1ry-1ehKajTGJGQCbyn0fcEM """ -from __future__ import print_function import os import shlex -- cgit v1.2.3 From fdcd39d5de4bd61cee94cf1e26416838d23092b8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 13 Sep 2022 14:19:58 -0400 Subject: Update license boilerplate text in source code files Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icb42e5012a87920c2cd13b666fb3e55e7e4fb3b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3891080 Auto-Submit: Mike Frysinger Tested-by: Mike Frysinger Commit-Queue: George Burgess Reviewed-by: George Burgess --- binary_search_tool/compiler_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'binary_search_tool/compiler_wrapper.py') diff --git a/binary_search_tool/compiler_wrapper.py b/binary_search_tool/compiler_wrapper.py index 02dd332e..c32826b0 100755 --- a/binary_search_tool/compiler_wrapper.py +++ b/binary_search_tool/compiler_wrapper.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2020 The ChromiumOS Authors. All rights reserved. +# Copyright 2020 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -- cgit v1.2.3