From 6ea78398aa9a5d84c2d414b2226ffc028cd21a43 Mon Sep 17 00:00:00 2001 From: Michael Achenbach Date: Fri, 5 Aug 2022 14:55:59 +0200 Subject: [PATCH] [infra] Change all Python shebangs to Python3 The infrastructure runs everything already in Python3, so this is mostly a clean-up. For MB, a python2 holdover was removed and new lint errors were fixed. The renames were automated with: git grep -e "/usr/bin/python$" | cut -d':' -f1 | xargs sed -i 's/#!\/usr\/bin\/python$/#!\/usr\/bin\/python3/1' and git grep -e "/usr/bin/env python$" | cut -d':' -f1 | xargs sed -i 's/#!\/usr\/bin\/env python$/#!\/usr\/bin\/env python3/1' Bug: v8:13148 Change-Id: If4f3c7635e72fa134798d55314ac1aa92ddd01bf Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3811499 Reviewed-by: Liviu Rau Commit-Queue: Michael Achenbach Cr-Commit-Position: refs/heads/main@{#82231} --- gni/protoc.py | 2 +- test/benchmarks/csuite/benchmark.py | 2 +- test/benchmarks/csuite/compare-baseline.py | 2 +- test/benchmarks/csuite/csuite.py | 2 +- .../test262-harness/src/_monkeyYaml.py | 2 +- .../test262-harness/src/parseTestRecord.py | 2 +- third_party/test262-harness/src/test262.py | 2 +- .../test262-harness/test/test_common.py | 2 +- .../test262-harness/test/test_monkeyYaml.py | 2 +- .../test/test_parseTestRecord.py | 2 +- .../test262-harness/test/test_test262.py | 2 +- tools/__init__.py | 2 +- tools/adb-d8.py | 2 +- tools/android-run.py | 2 +- tools/avg.py | 2 +- tools/bigint-tester.py | 2 +- tools/builtins-pgo/combine_hints.py | 2 +- tools/builtins-pgo/generate.py | 2 +- tools/builtins-pgo/get_hints.py | 2 +- tools/callstats.py | 2 +- tools/clusterfuzz/js_fuzzer/tools/fuzz_one.py | 2 +- tools/clusterfuzz/js_fuzzer/tools/minimize.py | 2 +- tools/clusterfuzz/js_fuzzer/tools/run_one.py | 2 +- .../clusterfuzz/js_fuzzer/tools/workbench.py | 2 +- tools/dev/gen-tags.py | 2 +- tools/dev/v8gen.py | 2 +- tools/disasm.py | 2 +- tools/dump-cpp.py | 2 +- tools/eval_gc_nvp.py | 2 +- tools/find-commit-for-patch.py | 2 +- tools/gc-nvp-to-csv.py | 2 +- tools/gc-nvp-trace-processor.py | 2 +- tools/gen-inlining-tests.py | 2 +- tools/gen-keywords-gen-h.py | 2 +- tools/gen-postmortem-metadata.py | 2 +- tools/gen-v8-gn.py | 2 +- tools/generate-builtins-tests.py | 2 +- tools/generate-header-include-checks.py | 2 +- .../generate_shim_headers.py | 2 +- tools/locs.py | 2 +- tools/mb/PRESUBMIT.py | 8 +++++--- tools/mb/mb.py | 20 +++++++++---------- tools/mb/mb_test.py | 16 +++++++-------- tools/objdump-v8 | 2 +- tools/perf-compare.py | 2 +- tools/profiling/ll_prof.py | 2 +- tools/regexp-sequences.py | 2 +- tools/release/auto_roll.py | 2 +- tools/release/filter_build_files.py | 2 +- tools/release/mergeinfo.py | 2 +- tools/release/test_mergeinfo.py | 2 +- tools/run-clang-tidy.py | 2 +- tools/run-num-fuzzer.py | 2 +- tools/run-tests.py | 2 +- tools/run-wasm-api-tests.py | 2 +- tools/sanitizers/sancov_formatter.py | 2 +- tools/sanitizers/sancov_merger.py | 2 +- tools/sanitizers/sanitize_pcs.py | 2 +- tools/snapshot/asm_to_inline_asm.py | 2 +- tools/stats-viewer.py | 2 +- .../local/fake_testsuite/testcfg.py | 2 +- tools/try_perf.py | 2 +- tools/unittests/testdata/d8_mocked1.py | 2 +- tools/unittests/testdata/d8_mocked2.py | 2 +- tools/unittests/testdata/results_processor.py | 2 +- tools/v8windbg/copy-prereqs.py | 2 +- .../inject-compilation-hints.py | 2 +- .../wasm-objdump-compilation-hints.py | 2 +- tools/wasm-compilation-hints/wasm.py | 2 +- 69 files changed, 89 insertions(+), 87 deletions(-) diff --git a/gni/protoc.py b/gni/protoc.py index dc8920009d..d529d1c65a 100755 --- a/gni/protoc.py +++ b/gni/protoc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2021 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/test/benchmarks/csuite/benchmark.py b/test/benchmarks/csuite/benchmark.py index 5d6fd0a670..99c472ca41 100755 --- a/test/benchmarks/csuite/benchmark.py +++ b/test/benchmarks/csuite/benchmark.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright 2018 the V8 project authors. All rights reserved. ''' diff --git a/test/benchmarks/csuite/compare-baseline.py b/test/benchmarks/csuite/compare-baseline.py index c05e20e806..f5015124ed 100755 --- a/test/benchmarks/csuite/compare-baseline.py +++ b/test/benchmarks/csuite/compare-baseline.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright 2018 the V8 project authors. All rights reserved. ''' diff --git a/test/benchmarks/csuite/csuite.py b/test/benchmarks/csuite/csuite.py index 4e7c4f35a6..70eb573606 100755 --- a/test/benchmarks/csuite/csuite.py +++ b/test/benchmarks/csuite/csuite.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright 2018 the V8 project authors. All rights reserved. ''' C S u i t e because who can remember? diff --git a/third_party/test262-harness/src/_monkeyYaml.py b/third_party/test262-harness/src/_monkeyYaml.py index b988c433c1..ab9b39af3e 100644 --- a/third_party/test262-harness/src/_monkeyYaml.py +++ b/third_party/test262-harness/src/_monkeyYaml.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 by Sam Mikes. All rights reserved. # This code is governed by the BSD license found in the LICENSE file. diff --git a/third_party/test262-harness/src/parseTestRecord.py b/third_party/test262-harness/src/parseTestRecord.py index 1c2aba80af..313ab7f3d0 100644 --- a/third_party/test262-harness/src/parseTestRecord.py +++ b/third_party/test262-harness/src/parseTestRecord.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2011 by Google, Inc. All rights reserved. # This code is governed by the BSD license found in the LICENSE file. diff --git a/third_party/test262-harness/src/test262.py b/third_party/test262-harness/src/test262.py index c92e5bf0cf..1ec563fc58 100755 --- a/third_party/test262-harness/src/test262.py +++ b/third_party/test262-harness/src/test262.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2009 the Sputnik authors. All rights reserved. # This code is governed by the BSD license found in the LICENSE file. diff --git a/third_party/test262-harness/test/test_common.py b/third_party/test262-harness/test/test_common.py index 4c86b0a334..4f399fd027 100644 --- a/third_party/test262-harness/test/test_common.py +++ b/third_party/test262-harness/test/test_common.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 by Sam Mikes. All rights reserved. # This code is governed by the BSD license found in the LICENSE file. diff --git a/third_party/test262-harness/test/test_monkeyYaml.py b/third_party/test262-harness/test/test_monkeyYaml.py index 428e45b6a0..1b97ea842d 100644 --- a/third_party/test262-harness/test/test_monkeyYaml.py +++ b/third_party/test262-harness/test/test_monkeyYaml.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 by Sam Mikes. All rights reserved. # This code is governed by the BSD license found in the LICENSE file. diff --git a/third_party/test262-harness/test/test_parseTestRecord.py b/third_party/test262-harness/test/test_parseTestRecord.py index 36576b57b1..869c8fb2d3 100644 --- a/third_party/test262-harness/test/test_parseTestRecord.py +++ b/third_party/test262-harness/test/test_parseTestRecord.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 by Sam Mikes. All rights reserved. # This code is governed by the BSD license found in the LICENSE file. diff --git a/third_party/test262-harness/test/test_test262.py b/third_party/test262-harness/test/test_test262.py index 8cf41d79f0..16becd192b 100644 --- a/third_party/test262-harness/test/test_test262.py +++ b/third_party/test262-harness/test/test_test262.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 by Sam Mikes. All rights reserved. # This code is governed by the BSD license found in the LICENSE file. diff --git a/tools/__init__.py b/tools/__init__.py index 3841a861c8..e1bbf0cdfc 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/adb-d8.py b/tools/adb-d8.py index f2e67e85a6..cdb258813d 100755 --- a/tools/adb-d8.py +++ b/tools/adb-d8.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/android-run.py b/tools/android-run.py index 66d333a25b..ff0379869c 100755 --- a/tools/android-run.py +++ b/tools/android-run.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without diff --git a/tools/avg.py b/tools/avg.py index 5741acd388..b275c7f1af 100755 --- a/tools/avg.py +++ b/tools/avg.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can diff --git a/tools/bigint-tester.py b/tools/bigint-tester.py index 0940369ac5..6cc8d98cf4 100755 --- a/tools/bigint-tester.py +++ b/tools/bigint-tester.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/builtins-pgo/combine_hints.py b/tools/builtins-pgo/combine_hints.py index 18c45edd96..25412e9749 100755 --- a/tools/builtins-pgo/combine_hints.py +++ b/tools/builtins-pgo/combine_hints.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2022 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can diff --git a/tools/builtins-pgo/generate.py b/tools/builtins-pgo/generate.py index be5b12935b..a77b7bb9a6 100755 --- a/tools/builtins-pgo/generate.py +++ b/tools/builtins-pgo/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2022 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can diff --git a/tools/builtins-pgo/get_hints.py b/tools/builtins-pgo/get_hints.py index 3e53ad9d6c..b717dc05ca 100755 --- a/tools/builtins-pgo/get_hints.py +++ b/tools/builtins-pgo/get_hints.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2022 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can diff --git a/tools/callstats.py b/tools/callstats.py index 1b76d0c166..dbeb1c9721 100755 --- a/tools/callstats.py +++ b/tools/callstats.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/clusterfuzz/js_fuzzer/tools/fuzz_one.py b/tools/clusterfuzz/js_fuzzer/tools/fuzz_one.py index 28646d4c8f..c3df79ec27 100644 --- a/tools/clusterfuzz/js_fuzzer/tools/fuzz_one.py +++ b/tools/clusterfuzz/js_fuzzer/tools/fuzz_one.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/clusterfuzz/js_fuzzer/tools/minimize.py b/tools/clusterfuzz/js_fuzzer/tools/minimize.py index 8729b2acac..be864d5463 100644 --- a/tools/clusterfuzz/js_fuzzer/tools/minimize.py +++ b/tools/clusterfuzz/js_fuzzer/tools/minimize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/clusterfuzz/js_fuzzer/tools/run_one.py b/tools/clusterfuzz/js_fuzzer/tools/run_one.py index 7886c30b95..4719fe0e72 100644 --- a/tools/clusterfuzz/js_fuzzer/tools/run_one.py +++ b/tools/clusterfuzz/js_fuzzer/tools/run_one.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/clusterfuzz/js_fuzzer/tools/workbench.py b/tools/clusterfuzz/js_fuzzer/tools/workbench.py index ee371f5482..5a4fc0a19c 100644 --- a/tools/clusterfuzz/js_fuzzer/tools/workbench.py +++ b/tools/clusterfuzz/js_fuzzer/tools/workbench.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/dev/gen-tags.py b/tools/dev/gen-tags.py index a478ee3f56..5bed28e3fa 100755 --- a/tools/dev/gen-tags.py +++ b/tools/dev/gen-tags.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/dev/v8gen.py b/tools/dev/v8gen.py index c6ba1d2174..6874c57155 100755 --- a/tools/dev/v8gen.py +++ b/tools/dev/v8gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/disasm.py b/tools/disasm.py index cd27faa506..71fff96c68 100644 --- a/tools/disasm.py +++ b/tools/disasm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2011 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without diff --git a/tools/dump-cpp.py b/tools/dump-cpp.py index 58c08c8a7f..27b59b19a0 100644 --- a/tools/dump-cpp.py +++ b/tools/dump-cpp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/eval_gc_nvp.py b/tools/eval_gc_nvp.py index 222ebef7d3..dea2da46c3 100755 --- a/tools/eval_gc_nvp.py +++ b/tools/eval_gc_nvp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2015 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/find-commit-for-patch.py b/tools/find-commit-for-patch.py index cca1f40d55..a1995669b6 100755 --- a/tools/find-commit-for-patch.py +++ b/tools/find-commit-for-patch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/gc-nvp-to-csv.py b/tools/gc-nvp-to-csv.py index b3ad374185..f8590717bb 100755 --- a/tools/gc-nvp-to-csv.py +++ b/tools/gc-nvp-to-csv.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2015 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/gc-nvp-trace-processor.py b/tools/gc-nvp-trace-processor.py index 75d50b1cda..f5f8be4c84 100755 --- a/tools/gc-nvp-trace-processor.py +++ b/tools/gc-nvp-trace-processor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2010 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without diff --git a/tools/gen-inlining-tests.py b/tools/gen-inlining-tests.py index 484faa10e8..97323a9870 100644 --- a/tools/gen-inlining-tests.py +++ b/tools/gen-inlining-tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/gen-keywords-gen-h.py b/tools/gen-keywords-gen-h.py index 97c91ee289..a61f51aab5 100755 --- a/tools/gen-keywords-gen-h.py +++ b/tools/gen-keywords-gen-h.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/gen-postmortem-metadata.py b/tools/gen-postmortem-metadata.py index 43fe38c03d..4ffa36560e 100644 --- a/tools/gen-postmortem-metadata.py +++ b/tools/gen-postmortem-metadata.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2012 the V8 project authors. All rights reserved. diff --git a/tools/gen-v8-gn.py b/tools/gen-v8-gn.py index 21d9f3a3a2..06f352c163 100755 --- a/tools/gen-v8-gn.py +++ b/tools/gen-v8-gn.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2021 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/generate-builtins-tests.py b/tools/generate-builtins-tests.py index 3abe750b53..c4286e958a 100755 --- a/tools/generate-builtins-tests.py +++ b/tools/generate-builtins-tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/generate-header-include-checks.py b/tools/generate-header-include-checks.py index fd95b83004..c52b0f9663 100755 --- a/tools/generate-header-include-checks.py +++ b/tools/generate-header-include-checks.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # vim:fenc=utf-8:shiftwidth=2 # Copyright 2018 the V8 project authors. All rights reserved. diff --git a/tools/generate_shim_headers/generate_shim_headers.py b/tools/generate_shim_headers/generate_shim_headers.py index d0e6d069de..647d30faa3 100755 --- a/tools/generate_shim_headers/generate_shim_headers.py +++ b/tools/generate_shim_headers/generate_shim_headers.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without diff --git a/tools/locs.py b/tools/locs.py index bd1609dc7f..f8940c05e6 100755 --- a/tools/locs.py +++ b/tools/locs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/mb/PRESUBMIT.py b/tools/mb/PRESUBMIT.py index 150de90e88..bae713bc25 100644 --- a/tools/mb/PRESUBMIT.py +++ b/tools/mb/PRESUBMIT.py @@ -18,15 +18,17 @@ def _CommonChecks(input_api, output_api): # Run the MB unittests. results.extend( input_api.canned_checks.RunUnitTestsInDirectory(input_api, output_api, - '.', [r'^.+_test\.py$'])) + '.', [r'^.+_test\.py$'], + run_on_python2=False)) # Validate the format of the mb_config.pyl file. - cmd = [input_api.python_executable, 'mb.py', 'validate'] + cmd = [input_api.python3_executable, 'mb.py', 'validate'] kwargs = {'cwd': input_api.PresubmitLocalPath()} results.extend(input_api.RunTests([ input_api.Command(name='mb_validate', cmd=cmd, kwargs=kwargs, - message=output_api.PresubmitError)])) + message=output_api.PresubmitError, + python3=True)])) is_mb_config = (lambda filepath: 'mb_config.pyl' in filepath.LocalPath()) results.extend( diff --git a/tools/mb/mb.py b/tools/mb/mb.py index 1ba74b747b..f42b52bedb 100755 --- a/tools/mb/mb.py +++ b/tools/mb/mb.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be @@ -66,9 +66,9 @@ def _v8_builder_fallback(builder, builder_group): elif builder.endswith(' builder'): builders.append(builder[:-len(' builder')]) - for builder in builders: - if builder in builder_group: - return builder_group[builder] + for b in builders: + if b in builder_group: + return builder_group[b] return None @@ -77,7 +77,7 @@ def main(args): return mbw.Main(args) -class MetaBuildWrapper(object): +class MetaBuildWrapper(): def __init__(self): self.chromium_src_dir = CHROMIUM_SRC_DIR self.default_config = os.path.join(self.chromium_src_dir, 'infra', 'mb', @@ -562,7 +562,7 @@ class MetaBuildWrapper(object): contents = ast.literal_eval(self.ReadFile(self.args.config_file)) except SyntaxError as e: raise MBErr('Failed to parse config file "%s": %s' % - (self.args.config_file, e)) + (self.args.config_file, e)) from e self.configs = contents['configs'] self.luci_tryservers = contents.get('luci_tryservers', {}) @@ -587,8 +587,8 @@ class MetaBuildWrapper(object): ', '.join(duplicates)) isolate_maps.update(isolate_map) except SyntaxError as e: - raise MBErr( - 'Failed to parse isolate map file "%s": %s' % (isolate_map, e)) + raise MBErr('Failed to parse isolate map file "%s": %s' % + (isolate_map, e)) from e return isolate_maps def ConfigFromArgs(self): @@ -1071,7 +1071,7 @@ class MetaBuildWrapper(object): force_verbose=force_verbose) except Exception as e: raise MBErr('Error %s writing to the output path "%s"' % - (e, path)) + (e, path)) from e def CheckCompile(self, builder_group, builder): url_template = self.args.url_template + '/{builder}/builds/_all?as_text=1' @@ -1089,7 +1089,7 @@ class MetaBuildWrapper(object): if not successes: return "no successful builds" build = builds[str(successes[0])] - step_names = set([step["name"] for step in build["steps"]]) + step_names = {step["name"] for step in build["steps"]} compile_indicators = set(["compile", "compile (with patch)", "analyze"]) if compile_indicators & step_names: return "compiles" diff --git a/tools/mb/mb_test.py b/tools/mb/mb_test.py index fb59c4aa29..0f03adba82 100755 --- a/tools/mb/mb_test.py +++ b/tools/mb/mb_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright 2016 the V8 project authors. All rights reserved. # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be @@ -6,7 +6,7 @@ """Tests for mb.py.""" import json -import StringIO +import io import os import sys import unittest @@ -17,7 +17,7 @@ import mb class FakeMBW(mb.MetaBuildWrapper): def __init__(self, win32=False): - super(FakeMBW, self).__init__() + super().__init__() # Override vars for test portability. if win32: @@ -85,14 +85,14 @@ class FakeMBW(mb.MetaBuildWrapper): def RemoveFile(self, path): del self.files[path] - def RemoveDirectory(self, path): - self.rmdirs.append(path) - files_to_delete = [f for f in self.files if f.startswith(path)] + def RemoveDirectory(self, abs_path): + self.rmdirs.append(abs_path) + files_to_delete = [f for f in self.files if f.startswith(abs_path)] for f in files_to_delete: self.files[f] = None -class FakeFile(object): +class FakeFile(): def __init__(self, files): self.name = '/tmp/file' @@ -592,7 +592,7 @@ class UnitTest(unittest.TestCase): def test_help(self): orig_stdout = sys.stdout try: - sys.stdout = StringIO.StringIO() + sys.stdout = io.StringIO() self.assertRaises(SystemExit, self.check, ['-h']) self.assertRaises(SystemExit, self.check, ['help']) self.assertRaises(SystemExit, self.check, ['help', 'gen']) diff --git a/tools/objdump-v8 b/tools/objdump-v8 index dc7310a5f8..53f0af4e69 100755 --- a/tools/objdump-v8 +++ b/tools/objdump-v8 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2016 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without diff --git a/tools/perf-compare.py b/tools/perf-compare.py index 744f6aae97..31f91df805 100755 --- a/tools/perf-compare.py +++ b/tools/perf-compare.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/profiling/ll_prof.py b/tools/profiling/ll_prof.py index 44998743b4..998965694c 100755 --- a/tools/profiling/ll_prof.py +++ b/tools/profiling/ll_prof.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without diff --git a/tools/regexp-sequences.py b/tools/regexp-sequences.py index 9f920dd0f0..295f74acfb 100755 --- a/tools/regexp-sequences.py +++ b/tools/regexp-sequences.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2019 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/release/auto_roll.py b/tools/release/auto_roll.py index 4585b27f1f..cb72022310 100755 --- a/tools/release/auto_roll.py +++ b/tools/release/auto_roll.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/release/filter_build_files.py b/tools/release/filter_build_files.py index 65312b4b85..68c60efc87 100755 --- a/tools/release/filter_build_files.py +++ b/tools/release/filter_build_files.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/release/mergeinfo.py b/tools/release/mergeinfo.py index 5a82cbf7ce..d824f4738a 100755 --- a/tools/release/mergeinfo.py +++ b/tools/release/mergeinfo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/release/test_mergeinfo.py b/tools/release/test_mergeinfo.py index 9404542ef6..8c95de1116 100755 --- a/tools/release/test_mergeinfo.py +++ b/tools/release/test_mergeinfo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/run-clang-tidy.py b/tools/run-clang-tidy.py index aee1b40bef..b5de57ac3c 100755 --- a/tools/run-clang-tidy.py +++ b/tools/run-clang-tidy.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/run-num-fuzzer.py b/tools/run-num-fuzzer.py index 49e432998d..699d33cbd2 100755 --- a/tools/run-num-fuzzer.py +++ b/tools/run-num-fuzzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/run-tests.py b/tools/run-tests.py index d22c7303af..4ddf97f4e7 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/run-wasm-api-tests.py b/tools/run-wasm-api-tests.py index ff37c8a465..92df8ad0c2 100755 --- a/tools/run-wasm-api-tests.py +++ b/tools/run-wasm-api-tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2019 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/sanitizers/sancov_formatter.py b/tools/sanitizers/sancov_formatter.py index c95ff821c3..126acbd8f8 100755 --- a/tools/sanitizers/sancov_formatter.py +++ b/tools/sanitizers/sancov_formatter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/sanitizers/sancov_merger.py b/tools/sanitizers/sancov_merger.py index 6fd2eb2555..94ce24bfb4 100755 --- a/tools/sanitizers/sancov_merger.py +++ b/tools/sanitizers/sancov_merger.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/sanitizers/sanitize_pcs.py b/tools/sanitizers/sanitize_pcs.py index a1e3a1df2e..e23f4f2cd6 100755 --- a/tools/sanitizers/sanitize_pcs.py +++ b/tools/sanitizers/sanitize_pcs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/snapshot/asm_to_inline_asm.py b/tools/snapshot/asm_to_inline_asm.py index e49c961bb7..ce57d8fc0b 100644 --- a/tools/snapshot/asm_to_inline_asm.py +++ b/tools/snapshot/asm_to_inline_asm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/stats-viewer.py b/tools/stats-viewer.py index dd9d2c20bf..535402a452 100755 --- a/tools/stats-viewer.py +++ b/tools/stats-viewer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2008 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without diff --git a/tools/testrunner/local/fake_testsuite/testcfg.py b/tools/testrunner/local/fake_testsuite/testcfg.py index 7dc5d7068f..eced9ce8fc 100644 --- a/tools/testrunner/local/fake_testsuite/testcfg.py +++ b/tools/testrunner/local/fake_testsuite/testcfg.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2019 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/try_perf.py b/tools/try_perf.py index 55ae8b4412..24c481d21c 100755 --- a/tools/try_perf.py +++ b/tools/try_perf.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/unittests/testdata/d8_mocked1.py b/tools/unittests/testdata/d8_mocked1.py index ff330af8c4..ea0377c559 100644 --- a/tools/unittests/testdata/d8_mocked1.py +++ b/tools/unittests/testdata/d8_mocked1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/unittests/testdata/d8_mocked2.py b/tools/unittests/testdata/d8_mocked2.py index 36304628aa..c071e15a37 100644 --- a/tools/unittests/testdata/d8_mocked2.py +++ b/tools/unittests/testdata/d8_mocked2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/unittests/testdata/results_processor.py b/tools/unittests/testdata/results_processor.py index d8c5ad9448..c2e3c8d0ed 100644 --- a/tools/unittests/testdata/results_processor.py +++ b/tools/unittests/testdata/results_processor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/v8windbg/copy-prereqs.py b/tools/v8windbg/copy-prereqs.py index c13efe6582..810535c4a3 100644 --- a/tools/v8windbg/copy-prereqs.py +++ b/tools/v8windbg/copy-prereqs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/wasm-compilation-hints/inject-compilation-hints.py b/tools/wasm-compilation-hints/inject-compilation-hints.py index fd4b65b8ff..b04bf2cd80 100755 --- a/tools/wasm-compilation-hints/inject-compilation-hints.py +++ b/tools/wasm-compilation-hints/inject-compilation-hints.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2019 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be found diff --git a/tools/wasm-compilation-hints/wasm-objdump-compilation-hints.py b/tools/wasm-compilation-hints/wasm-objdump-compilation-hints.py index 9077f97f70..a1dd8e4d39 100755 --- a/tools/wasm-compilation-hints/wasm-objdump-compilation-hints.py +++ b/tools/wasm-compilation-hints/wasm-objdump-compilation-hints.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2019 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be found diff --git a/tools/wasm-compilation-hints/wasm.py b/tools/wasm-compilation-hints/wasm.py index ae3d0841e8..bbd3e5bbbe 100644 --- a/tools/wasm-compilation-hints/wasm.py +++ b/tools/wasm-compilation-hints/wasm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2019 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be found