From d6b6b6279072cf677c12ea0ded691e8e294266ea Mon Sep 17 00:00:00 2001 From: DhruveshParmar Date: Sun, 24 Apr 2022 13:08:11 +0530 Subject: [PATCH 1/3] Use Python 3 (cherry picked from commit cd1a98cf4b42567d4e7b3d83ffb58b4cb14c8b54) (cherry picked from commit 609c50a2c57e84d666319335618d9b23568ea267) --- utils/build-script-impl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/build-script-impl b/utils/build-script-impl index 7de2ce01b1190..5714af5e1974c 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -337,7 +337,7 @@ function with_pushd() { } function quoted_print() { - python -c 'import pipes; import sys; print(" ".join(pipes.quote(arg) for arg in sys.argv[1:]))' "$@" + python3 -c 'import pipes; import sys; print(" ".join(pipes.quote(arg) for arg in sys.argv[1:]))' "$@" } function toupper() { From c496e8d947aa75267783e06b467b4b6f3cb7bd26 Mon Sep 17 00:00:00 2001 From: Daniel Duan Date: Wed, 13 Apr 2022 14:01:30 -0700 Subject: [PATCH 2/3] [NFC] Remove Python 2 imports from __future__ (#42086) The `__future__` we relied on is now, where the 3 specific things are all included [since Python 3.0](https://docs.python.org/3/library/__future__.html): * absolute_import * print_function * unicode_literals * division These import statements are no-ops and are no longer necessary. (cherry picked from commit 3dfc40898cdf6980bac4f6987e57719346833470) (cherry picked from commit 66bf05b1c8337d676d576102744fee84ce365ec6) --- benchmark/scripts/Benchmark_DTrace.in | 2 +- benchmark/scripts/Benchmark_Driver | 2 +- benchmark/scripts/Benchmark_GuardMalloc.in | 2 +- benchmark/scripts/Benchmark_QuickCheck.in | 2 +- benchmark/scripts/Benchmark_RuntimeLeaksRunner.in | 2 +- benchmark/scripts/build_linux.py | 2 +- benchmark/scripts/build_script_helper.py | 4 +--- benchmark/scripts/compare_perf_tests.py | 4 +--- benchmark/scripts/create_benchmark.py | 2 +- benchmark/scripts/generate_harness/generate_harness.py | 4 +--- benchmark/scripts/perf_test_driver/perf_test_driver.py | 4 +--- benchmark/scripts/run_smoke_bench | 4 +--- benchmark/scripts/test_Benchmark_Driver.py | 2 +- benchmark/scripts/test_compare_perf_tests.py | 2 +- benchmark/scripts/test_utils.py | 2 +- benchmark/utils/convertToJSON.py | 4 +--- docs/scripts/ns-html2rst | 4 +--- stdlib/public/core/FloatingPointTypes.swift.gyb | 1 - stdlib/public/core/IntegerTypes.swift.gyb | 1 - stdlib/public/core/SIMDConcreteOperations.swift.gyb | 1 - stdlib/public/core/SIMDVectorTypes.swift.gyb | 1 - test/CrossImport/Inputs/rewrite-module-triples.py | 4 +--- test/Driver/Dependencies/Inputs/fake-build-for-bitcode.py | 4 +--- test/Driver/Dependencies/Inputs/fake-build-whole-module.py | 4 +--- test/Driver/Dependencies/Inputs/modify-non-primary-files.py | 4 +--- test/Driver/Dependencies/Inputs/touch.py | 2 +- test/Driver/Dependencies/Inputs/update-dependencies-bad.py | 4 +--- test/Driver/Dependencies/Inputs/update-dependencies.py | 4 +--- test/Driver/Inputs/crash-after-generating-pch.py | 2 +- test/Driver/Inputs/crash.py | 2 +- test/Driver/Inputs/fail.py | 2 +- test/Driver/Inputs/fake-toolchain/clang | 4 +--- test/Driver/Inputs/fake-toolchain/ld | 4 +--- test/Driver/Inputs/filelists/check-filelist-abc.py | 4 +--- test/Driver/Inputs/filelists/fake-ld.py | 4 +--- test/Incremental/Verifier/gen-output-file-map.py | 4 +--- test/Inputs/getmtime.py | 4 +--- test/Inputs/symlink.py | 2 +- test/Inputs/timeout.py | 2 +- test/Misc/you-should-be-using-LLVM_DEBUG.test-sh | 2 +- test/ModuleInterface/ModuleCache/Inputs/check-is-new.py | 2 +- test/ModuleInterface/ModuleCache/Inputs/check-is-old.py | 2 +- test/ModuleInterface/ModuleCache/Inputs/make-old.py | 2 +- test/RemoteMirror/Inputs/interop.py | 4 +--- test/ScanDependencies/Inputs/CommandRunner.py | 2 +- test/Serialization/Inputs/binary_sub.py | 2 +- test/SourceKit/Inputs/sourcekitd_path_sanitize.py | 2 +- test/attr/Inputs/access-note-gen.py | 4 +--- test/lit.cfg | 1 - test/stdlib/Integers.swift.gyb | 1 - test/stdlib/NumericParsing.swift.gyb | 1 - test/stdlib/SIMDConcreteIntegers.swift.gyb | 1 - test/stdlib/SIMDConcreteMasks.swift.gyb | 1 - tools/swift-inspect/build_script_helper.py | 4 +--- utils/80+-check | 4 +--- utils/PathSanitizingFileCheck | 4 +--- utils/analyze_code_size.py | 2 +- utils/android/adb/commands.py | 2 -- utils/android/adb_clean.py | 2 +- utils/android/adb_push_built_products.py | 2 +- utils/android/adb_push_built_products/main.py | 2 -- utils/android/adb_test_runner.py | 2 +- utils/android/adb_test_runner/main.py | 2 -- utils/api_checker/sdk-module-lists/infer-imports.py | 2 -- utils/api_checker/swift-api-checker.py | 2 -- utils/apply-fixit-edits.py | 4 +--- utils/backtrace-check | 4 +--- utils/bug_reducer/bug_reducer/bug_reducer.py | 2 +- utils/bug_reducer/bug_reducer/func_bug_reducer.py | 2 -- utils/bug_reducer/bug_reducer/list_reducer.py | 2 -- utils/bug_reducer/bug_reducer/opt_bug_reducer.py | 2 -- utils/bug_reducer/bug_reducer/random_bug_finder.py | 2 -- utils/bug_reducer/bug_reducer/swift_tools.py | 2 -- utils/build-script | 2 -- utils/build-tooling-libs | 4 +--- utils/build_swift/build_swift/argparse/__init__.py | 2 -- utils/build_swift/build_swift/argparse/actions.py | 2 -- utils/build_swift/build_swift/argparse/parser.py | 3 --- utils/build_swift/build_swift/argparse/types.py | 2 -- utils/build_swift/build_swift/cache_utils.py | 3 --- utils/build_swift/build_swift/class_utils.py | 3 --- utils/build_swift/build_swift/constants.py | 5 ----- utils/build_swift/build_swift/defaults.py | 3 --- utils/build_swift/build_swift/driver_arguments.py | 3 --- utils/build_swift/build_swift/migration.py | 2 -- utils/build_swift/build_swift/presets.py | 2 -- utils/build_swift/build_swift/shell.py | 2 -- utils/build_swift/build_swift/versions.py | 2 -- utils/build_swift/build_swift/wrappers/__init__.py | 3 --- utils/build_swift/build_swift/wrappers/xcrun.py | 3 --- utils/build_swift/run_tests.py | 4 +--- utils/build_swift/tests/build_swift/argparse/test_actions.py | 2 -- utils/build_swift/tests/build_swift/argparse/test_parser.py | 2 -- utils/build_swift/tests/build_swift/argparse/test_types.py | 2 -- utils/build_swift/tests/build_swift/test_cache_utils.py | 2 -- utils/build_swift/tests/build_swift/test_constants.py | 3 --- utils/build_swift/tests/build_swift/test_defaults.py | 2 -- utils/build_swift/tests/build_swift/test_driver_arguments.py | 2 -- utils/build_swift/tests/build_swift/test_migration.py | 2 -- utils/build_swift/tests/build_swift/test_presets.py | 2 -- utils/build_swift/tests/build_swift/test_shell.py | 2 -- utils/build_swift/tests/build_swift/test_versions.py | 2 -- utils/build_swift/tests/build_swift/wrappers/test_xcrun.py | 2 -- utils/build_swift/tests/expected_options.py | 2 -- utils/build_swift/tests/utils.py | 2 -- utils/check_freestanding_dependencies.py | 2 +- utils/check_freestanding_size.py | 2 +- utils/chex.py | 4 +--- utils/cmpcodesize/cmpcodesize.py | 2 +- utils/cmpcodesize/cmpcodesize/compare.py | 2 -- utils/cmpcodesize/cmpcodesize/main.py | 4 +--- utils/coverage/coverage-build-db | 2 +- utils/coverage/coverage-generate-data | 2 +- utils/coverage/coverage-query-db | 2 +- utils/coverage/coverage-touch-tests | 4 +--- utils/create-filecheck-test.py | 2 +- utils/dev-scripts/blockifyasm | 4 +--- utils/dev-scripts/csvcolumn_to_scurve.py | 2 +- utils/dev-scripts/scurve_printer.py | 2 +- utils/dev-scripts/split-cmdline | 4 +--- utils/generate_confusables.py | 2 +- utils/gyb.py | 2 -- utils/gyb_syntax_support/Node.py | 1 - utils/gyb_syntax_support/Traits.py | 2 +- utils/incrparse/incr_transfer_round_trip.py | 4 +--- utils/incrparse/test_util.py | 4 +--- utils/incrparse/validate_parse.py | 4 +--- utils/jobstats/__init__.py | 2 +- utils/jobstats/jobstats.py | 2 +- utils/line-directive | 4 +--- utils/lldb/lldbCheckExpect.py | 1 - utils/lldb/lldbToolBox.py | 2 -- utils/optimizer_counters_to_sql.py | 2 +- utils/pass-pipeline/scripts/pipeline_generator.py | 2 +- utils/pass-pipeline/scripts/pipelines_build_script.py | 2 +- utils/process-stats-dir.py | 2 +- utils/protocol_graph.py | 2 -- utils/pygments/swift.py | 2 +- utils/python_lint.py | 2 -- utils/recursive-lipo | 4 +--- utils/refactor-check-compiles.py | 4 +--- utils/remote-run | 4 +--- utils/resolve-crashes.py | 4 +--- utils/round-trip-syntax-test | 4 +--- utils/rth | 4 +--- utils/run-test | 2 -- utils/rusage.py | 2 +- utils/scale-test | 4 +--- utils/sil-opt-verify-all-modules.py | 4 +--- utils/split_file.py | 2 +- utils/submit-benchmark-results | 4 +--- utils/swift-api-dump.py | 4 +--- utils/swift-bench.py | 4 +--- utils/swift-rpathize.py | 2 +- utils/swift_build_sdk_interfaces.py | 4 +--- utils/swift_build_support/run_tests.py | 4 +--- utils/swift_build_support/swift_build_support/cmake.py | 2 -- utils/swift_build_support/swift_build_support/shell.py | 2 -- utils/swift_build_support/swift_build_support/toolchain.py | 2 -- utils/swift_build_support/swift_build_support/utils.py | 2 -- utils/swift_build_support/tests/mock-distcc | 4 +--- utils/swift_build_support/tests/test_build_graph.py | 2 -- utils/swift_build_support/tests/test_cmake.py | 2 -- utils/symbolicate-linux-fatal | 4 +--- utils/type-layout-fuzzer.py | 4 +--- utils/viewcfg | 4 +--- utils/vim/swift-indent.py | 2 -- validation-test/ParseableInterface/verify_all_overlays.py | 4 +--- validation-test/SIL/verify_all_overlays.py | 2 -- validation-test/stdlib/FixedPoint.swift.gyb | 1 - validation-test/stdlib/UnicodeTrieGenerator.gyb | 2 -- 171 files changed, 104 insertions(+), 347 deletions(-) diff --git a/benchmark/scripts/Benchmark_DTrace.in b/benchmark/scripts/Benchmark_DTrace.in index fdc98f6a8aba6..36a83b4fe140c 100644 --- a/benchmark/scripts/Benchmark_DTrace.in +++ b/benchmark/scripts/Benchmark_DTrace.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- Benchmark_DTrace.in ---------------------------------------------===// # diff --git a/benchmark/scripts/Benchmark_Driver b/benchmark/scripts/Benchmark_Driver index 371b6bccf9b04..75f194a965bf9 100755 --- a/benchmark/scripts/Benchmark_Driver +++ b/benchmark/scripts/Benchmark_Driver @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ===--- Benchmark_Driver ------------------------------------------------===// diff --git a/benchmark/scripts/Benchmark_GuardMalloc.in b/benchmark/scripts/Benchmark_GuardMalloc.in index 872179e1d28de..880d0baa55c18 100644 --- a/benchmark/scripts/Benchmark_GuardMalloc.in +++ b/benchmark/scripts/Benchmark_GuardMalloc.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- Benchmark_GuardMalloc.in ----------------------------------------===// # diff --git a/benchmark/scripts/Benchmark_QuickCheck.in b/benchmark/scripts/Benchmark_QuickCheck.in index 4f78101bac076..25fdd08bbd37d 100644 --- a/benchmark/scripts/Benchmark_QuickCheck.in +++ b/benchmark/scripts/Benchmark_QuickCheck.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- Benchmark_QuickCheck.in -----------------------------------------===// # diff --git a/benchmark/scripts/Benchmark_RuntimeLeaksRunner.in b/benchmark/scripts/Benchmark_RuntimeLeaksRunner.in index d59ea41032c0f..91e65aab62299 100644 --- a/benchmark/scripts/Benchmark_RuntimeLeaksRunner.in +++ b/benchmark/scripts/Benchmark_RuntimeLeaksRunner.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- Benchmark_RuntimeLeaksRunner.in ---------------------------------===// # diff --git a/benchmark/scripts/build_linux.py b/benchmark/scripts/build_linux.py index 4404815931182..0bff995336eba 100755 --- a/benchmark/scripts/build_linux.py +++ b/benchmark/scripts/build_linux.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import os diff --git a/benchmark/scripts/build_script_helper.py b/benchmark/scripts/build_script_helper.py index 53bf7b19f6862..8fe3903b6825b 100755 --- a/benchmark/scripts/build_script_helper.py +++ b/benchmark/scripts/build_script_helper.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import os diff --git a/benchmark/scripts/compare_perf_tests.py b/benchmark/scripts/compare_perf_tests.py index aeab79186b161..ac48ab4feef3f 100755 --- a/benchmark/scripts/compare_perf_tests.py +++ b/benchmark/scripts/compare_perf_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ===--- compare_perf_tests.py -------------------------------------------===// @@ -27,8 +27,6 @@ class `ReportFormatter` creates the test comparison report in specified format. """ -from __future__ import print_function - import argparse import functools import re diff --git a/benchmark/scripts/create_benchmark.py b/benchmark/scripts/create_benchmark.py index cccaae23c76bd..e097d8f799a63 100755 --- a/benchmark/scripts/create_benchmark.py +++ b/benchmark/scripts/create_benchmark.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import os diff --git a/benchmark/scripts/generate_harness/generate_harness.py b/benchmark/scripts/generate_harness/generate_harness.py index c5c6f87242133..0c3c2f4b22b2e 100755 --- a/benchmark/scripts/generate_harness/generate_harness.py +++ b/benchmark/scripts/generate_harness/generate_harness.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- generate_harness.py ---------------------------------------------===// # @@ -14,8 +14,6 @@ # Generate boilerplate, CMakeLists.txt and utils/main.swift from templates. -from __future__ import print_function - import argparse import os import subprocess diff --git a/benchmark/scripts/perf_test_driver/perf_test_driver.py b/benchmark/scripts/perf_test_driver/perf_test_driver.py index c662345333682..a2af09444d38e 100644 --- a/benchmark/scripts/perf_test_driver/perf_test_driver.py +++ b/benchmark/scripts/perf_test_driver/perf_test_driver.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- perf_test_driver.py ---------------------------------------------===// # @@ -12,8 +12,6 @@ # # ===---------------------------------------------------------------------===// -from __future__ import print_function - import functools import glob import multiprocessing diff --git a/benchmark/scripts/run_smoke_bench b/benchmark/scripts/run_smoke_bench index 72d434c33996a..6c1a1d6a14633 100755 --- a/benchmark/scripts/run_smoke_bench +++ b/benchmark/scripts/run_smoke_bench @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ===--- run_smoke_bench -------------------------------------------------===// @@ -21,8 +21,6 @@ # # ===---------------------------------------------------------------------===// -from __future__ import print_function - import argparse import glob import os diff --git a/benchmark/scripts/test_Benchmark_Driver.py b/benchmark/scripts/test_Benchmark_Driver.py index e3411060bead8..bad4ea83a4c7c 100644 --- a/benchmark/scripts/test_Benchmark_Driver.py +++ b/benchmark/scripts/test_Benchmark_Driver.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ===--- test_Benchmark_Driver.py ----------------------------------------===// diff --git a/benchmark/scripts/test_compare_perf_tests.py b/benchmark/scripts/test_compare_perf_tests.py index 20d821208f752..66792f797e5cd 100644 --- a/benchmark/scripts/test_compare_perf_tests.py +++ b/benchmark/scripts/test_compare_perf_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ===--- test_compare_perf_tests.py --------------------------------------===// diff --git a/benchmark/scripts/test_utils.py b/benchmark/scripts/test_utils.py index 2980b9954591d..c9f634829897e 100644 --- a/benchmark/scripts/test_utils.py +++ b/benchmark/scripts/test_utils.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ===--- test_utils.py ---------------------------------------------------===// diff --git a/benchmark/utils/convertToJSON.py b/benchmark/utils/convertToJSON.py index b7a547116d7ba..717fee1243b5e 100644 --- a/benchmark/utils/convertToJSON.py +++ b/benchmark/utils/convertToJSON.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- convertToJSON.py ------------------------------------------------===// # @@ -57,8 +57,6 @@ # ] # } -from __future__ import print_function - import json import re import sys diff --git a/docs/scripts/ns-html2rst b/docs/scripts/ns-html2rst index 6644f8adc37df..dd2c7cdeb9022 100755 --- a/docs/scripts/ns-html2rst +++ b/docs/scripts/ns-html2rst @@ -1,6 +1,4 @@ -#!/usr/bin/env python -from __future__ import print_function - +#!/usr/bin/env python3 import re import subprocess import sys diff --git a/stdlib/public/core/FloatingPointTypes.swift.gyb b/stdlib/public/core/FloatingPointTypes.swift.gyb index f4be483feaa34..6bf8fe25568b9 100644 --- a/stdlib/public/core/FloatingPointTypes.swift.gyb +++ b/stdlib/public/core/FloatingPointTypes.swift.gyb @@ -13,7 +13,6 @@ import SwiftShims %{ -from __future__ import division from SwiftIntTypes import all_integer_types from SwiftFloatingPointTypes import all_floating_point_types diff --git a/stdlib/public/core/IntegerTypes.swift.gyb b/stdlib/public/core/IntegerTypes.swift.gyb index 6466fdb5d8787..b39637f3b8ada 100644 --- a/stdlib/public/core/IntegerTypes.swift.gyb +++ b/stdlib/public/core/IntegerTypes.swift.gyb @@ -14,7 +14,6 @@ # Utility code for later in this template # -from __future__ import division from SwiftIntTypes import all_integer_types, int_max_bits, should_define_truncating_bit_pattern_init from SwiftFloatingPointTypes import getFtoIBounds diff --git a/stdlib/public/core/SIMDConcreteOperations.swift.gyb b/stdlib/public/core/SIMDConcreteOperations.swift.gyb index cc6cbd274a432..98424a01bbfda 100644 --- a/stdlib/public/core/SIMDConcreteOperations.swift.gyb +++ b/stdlib/public/core/SIMDConcreteOperations.swift.gyb @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// %{ -from __future__ import division from SwiftIntTypes import all_integer_types word_bits = int(CMAKE_SIZEOF_VOID_P) * 8 storagescalarCounts = [2,4,8,16,32,64] diff --git a/stdlib/public/core/SIMDVectorTypes.swift.gyb b/stdlib/public/core/SIMDVectorTypes.swift.gyb index 5576f5acefcd7..ba56215a8b0f7 100644 --- a/stdlib/public/core/SIMDVectorTypes.swift.gyb +++ b/stdlib/public/core/SIMDVectorTypes.swift.gyb @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// %{ -from __future__ import division from SwiftIntTypes import all_integer_types word_bits = int(CMAKE_SIZEOF_VOID_P) * 8 storagescalarCounts = [2,4,8,16,32,64] diff --git a/test/CrossImport/Inputs/rewrite-module-triples.py b/test/CrossImport/Inputs/rewrite-module-triples.py index 2a6482b56ed29..ebc44098a6363 100644 --- a/test/CrossImport/Inputs/rewrite-module-triples.py +++ b/test/CrossImport/Inputs/rewrite-module-triples.py @@ -1,11 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Renames files or directories with "module-triple-here" in their names to use the indicated module triples instead. """ -from __future__ import print_function - import os import platform import shutil diff --git a/test/Driver/Dependencies/Inputs/fake-build-for-bitcode.py b/test/Driver/Dependencies/Inputs/fake-build-for-bitcode.py index 327f09e649dab..3652d13d62f48 100755 --- a/test/Driver/Dependencies/Inputs/fake-build-for-bitcode.py +++ b/test/Driver/Dependencies/Inputs/fake-build-for-bitcode.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # fake-build-for-bitcode.py - Fake build with -embed-bitcode -*- python -*- # # This source file is part of the Swift.org open source project @@ -16,8 +16,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import sys diff --git a/test/Driver/Dependencies/Inputs/fake-build-whole-module.py b/test/Driver/Dependencies/Inputs/fake-build-whole-module.py index 4df1fbcec498f..0574cf9418b37 100755 --- a/test/Driver/Dependencies/Inputs/fake-build-whole-module.py +++ b/test/Driver/Dependencies/Inputs/fake-build-whole-module.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # fake-build-for-whole-module.py - Optimized fake build -*- python -*- # # This source file is part of the Swift.org open source project @@ -15,8 +15,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import sys diff --git a/test/Driver/Dependencies/Inputs/modify-non-primary-files.py b/test/Driver/Dependencies/Inputs/modify-non-primary-files.py index 721b1ad48d097..0b4cf2526fddf 100755 --- a/test/Driver/Dependencies/Inputs/modify-non-primary-files.py +++ b/test/Driver/Dependencies/Inputs/modify-non-primary-files.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # modify-non-primary-files.py - Fake build while modifying files -*- python -*- # # This source file is part of the Swift.org open source project @@ -16,8 +16,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import sys diff --git a/test/Driver/Dependencies/Inputs/touch.py b/test/Driver/Dependencies/Inputs/touch.py index f5c609089303c..3537ee2d8ad18 100755 --- a/test/Driver/Dependencies/Inputs/touch.py +++ b/test/Driver/Dependencies/Inputs/touch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # touch.py - /bin/touch that writes the LLVM epoch -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/test/Driver/Dependencies/Inputs/update-dependencies-bad.py b/test/Driver/Dependencies/Inputs/update-dependencies-bad.py index dd5463259410f..33672973076bf 100755 --- a/test/Driver/Dependencies/Inputs/update-dependencies-bad.py +++ b/test/Driver/Dependencies/Inputs/update-dependencies-bad.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # update-dependencies-bad.py - Fails on bad.swift -*- python -*- # # This source file is part of the Swift.org open source project @@ -17,8 +17,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import shutil import signal diff --git a/test/Driver/Dependencies/Inputs/update-dependencies.py b/test/Driver/Dependencies/Inputs/update-dependencies.py index c366439e01358..22a8ca6525a0e 100755 --- a/test/Driver/Dependencies/Inputs/update-dependencies.py +++ b/test/Driver/Dependencies/Inputs/update-dependencies.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # update-dependencies.py - Fake build for dependency analysis -*- python -*- # # This source file is part of the Swift.org open source project @@ -27,8 +27,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import shutil import subprocess diff --git a/test/Driver/Inputs/crash-after-generating-pch.py b/test/Driver/Inputs/crash-after-generating-pch.py index 90bda5dcea287..1a16079c69f3b 100755 --- a/test/Driver/Inputs/crash-after-generating-pch.py +++ b/test/Driver/Inputs/crash-after-generating-pch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # crash.py - Sends SIGKILL to self. -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/test/Driver/Inputs/crash.py b/test/Driver/Inputs/crash.py index 6dd356aa1a841..fe363827a01a5 100755 --- a/test/Driver/Inputs/crash.py +++ b/test/Driver/Inputs/crash.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # crash.py - Sends SIGKILL to self. -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/test/Driver/Inputs/fail.py b/test/Driver/Inputs/fail.py index 750df0de2714d..9b7f82a3d5eb1 100755 --- a/test/Driver/Inputs/fail.py +++ b/test/Driver/Inputs/fail.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # fail.py - Just exits with an error code -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/test/Driver/Inputs/fake-toolchain/clang b/test/Driver/Inputs/fake-toolchain/clang index cb144ef304bdf..b7866191fdb62 100755 --- a/test/Driver/Inputs/fake-toolchain/clang +++ b/test/Driver/Inputs/fake-toolchain/clang @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # clang++ - Fake Clang to test finding clang++ in the toolchain path # # This source file is part of the Swift.org open source project @@ -11,6 +11,4 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - print("Sorry, I'm lazy-clang") diff --git a/test/Driver/Inputs/fake-toolchain/ld b/test/Driver/Inputs/fake-toolchain/ld index da2fa813eb2fc..1690e3f73d65c 100755 --- a/test/Driver/Inputs/fake-toolchain/ld +++ b/test/Driver/Inputs/fake-toolchain/ld @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ld - Fake ld to test finding the Darwin linker in the toolchain path # # This source file is part of the Swift.org open source project @@ -11,6 +11,4 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - print("Sorry, wrong number!") diff --git a/test/Driver/Inputs/filelists/check-filelist-abc.py b/test/Driver/Inputs/filelists/check-filelist-abc.py index 3a85d599a5042..8a2247740946a 100755 --- a/test/Driver/Inputs/filelists/check-filelist-abc.py +++ b/test/Driver/Inputs/filelists/check-filelist-abc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # check-filelist-abc.py - Fake build to test driver-produced -filelists. # # This source file is part of the Swift.org open source project @@ -11,8 +11,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import sys diff --git a/test/Driver/Inputs/filelists/fake-ld.py b/test/Driver/Inputs/filelists/fake-ld.py index 0c13dce47c0ea..94bc080763e77 100755 --- a/test/Driver/Inputs/filelists/fake-ld.py +++ b/test/Driver/Inputs/filelists/fake-ld.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # fake-ld.py - Fake Darwin linker to test driver-produced -filelists. # # This source file is part of the Swift.org open source project @@ -11,8 +11,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import sys filelistFile = sys.argv[sys.argv.index('-filelist') + 1] diff --git a/test/Incremental/Verifier/gen-output-file-map.py b/test/Incremental/Verifier/gen-output-file-map.py index adb8beaef56d5..417b5dbb64fef 100644 --- a/test/Incremental/Verifier/gen-output-file-map.py +++ b/test/Incremental/Verifier/gen-output-file-map.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import io diff --git a/test/Inputs/getmtime.py b/test/Inputs/getmtime.py index 6791b7b88b86b..6972d734b4387 100755 --- a/test/Inputs/getmtime.py +++ b/test/Inputs/getmtime.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import os import sys diff --git a/test/Inputs/symlink.py b/test/Inputs/symlink.py index c796a43b0f6ba..0cfe38beb5120 100644 --- a/test/Inputs/symlink.py +++ b/test/Inputs/symlink.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import subprocess import sys diff --git a/test/Inputs/timeout.py b/test/Inputs/timeout.py index 46d88b039b282..6d8ae2eea5538 100644 --- a/test/Inputs/timeout.py +++ b/test/Inputs/timeout.py @@ -1,4 +1,4 @@ -#!/uar/bin/env python +#!/uar/bin/env python3 import subprocess import sys diff --git a/test/Misc/you-should-be-using-LLVM_DEBUG.test-sh b/test/Misc/you-should-be-using-LLVM_DEBUG.test-sh index 1c9b6ed43a051..bb987f8d48d2f 100644 --- a/test/Misc/you-should-be-using-LLVM_DEBUG.test-sh +++ b/test/Misc/you-should-be-using-LLVM_DEBUG.test-sh @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # -*- python -*- # RUN: %{python} %s '%swift_src_root' diff --git a/test/ModuleInterface/ModuleCache/Inputs/check-is-new.py b/test/ModuleInterface/ModuleCache/Inputs/check-is-new.py index 61f79312f3d62..4604655c5f8f6 100755 --- a/test/ModuleInterface/ModuleCache/Inputs/check-is-new.py +++ b/test/ModuleInterface/ModuleCache/Inputs/check-is-new.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # check-is-new.py - a more-legible way to read a timestamp test than test(1) # diff --git a/test/ModuleInterface/ModuleCache/Inputs/check-is-old.py b/test/ModuleInterface/ModuleCache/Inputs/check-is-old.py index 23fa01d128de7..262552492dc7e 100755 --- a/test/ModuleInterface/ModuleCache/Inputs/check-is-old.py +++ b/test/ModuleInterface/ModuleCache/Inputs/check-is-old.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # check-is-old.py - a more-legible way to read a timestamp test than test(1) # diff --git a/test/ModuleInterface/ModuleCache/Inputs/make-old.py b/test/ModuleInterface/ModuleCache/Inputs/make-old.py index a97c6c44a9dd1..4b41e48ba69c5 100755 --- a/test/ModuleInterface/ModuleCache/Inputs/make-old.py +++ b/test/ModuleInterface/ModuleCache/Inputs/make-old.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # make-old.py - /bin/touch that writes a constant "old" timestamp. # diff --git a/test/RemoteMirror/Inputs/interop.py b/test/RemoteMirror/Inputs/interop.py index ee8543eb795c8..f5ca1332cdc8b 100755 --- a/test/RemoteMirror/Inputs/interop.py +++ b/test/RemoteMirror/Inputs/interop.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Exercise the SwiftRemoteMirrorLegacyInterop API. This works with # multiple versions of Swift. It builds Swift code using all versions, @@ -7,8 +7,6 @@ # # Invoke by passing the various Swift build directories as parameters. -from __future__ import print_function - import itertools import os import subprocess diff --git a/test/ScanDependencies/Inputs/CommandRunner.py b/test/ScanDependencies/Inputs/CommandRunner.py index c2812bb7cd964..6e047c6d577b5 100755 --- a/test/ScanDependencies/Inputs/CommandRunner.py +++ b/test/ScanDependencies/Inputs/CommandRunner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import subprocess import sys diff --git a/test/Serialization/Inputs/binary_sub.py b/test/Serialization/Inputs/binary_sub.py index 096aeb75dcafd..b1b3378db4ae1 100755 --- a/test/Serialization/Inputs/binary_sub.py +++ b/test/Serialization/Inputs/binary_sub.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys diff --git a/test/SourceKit/Inputs/sourcekitd_path_sanitize.py b/test/SourceKit/Inputs/sourcekitd_path_sanitize.py index cb90e334e7ecd..30cd905421834 100644 --- a/test/SourceKit/Inputs/sourcekitd_path_sanitize.py +++ b/test/SourceKit/Inputs/sourcekitd_path_sanitize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # sourcekitd_path_sanitize.py - Cleans up paths from sourcekitd-test output # # This source file is part of the Swift.org open source project diff --git a/test/attr/Inputs/access-note-gen.py b/test/attr/Inputs/access-note-gen.py index 776c5f99758ec..5fe4df09a58f8 100644 --- a/test/attr/Inputs/access-note-gen.py +++ b/test/attr/Inputs/access-note-gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding=utf8 """ @@ -6,8 +6,6 @@ the originals in the process. """ -from __future__ import print_function - import io import re import sys diff --git a/test/lit.cfg b/test/lit.cfg index 7ed452608d539..9bfd5cb0523b9 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -18,7 +18,6 @@ # # ----------------------------------------------------------------------------- -from __future__ import absolute_import import os import platform import re diff --git a/test/stdlib/Integers.swift.gyb b/test/stdlib/Integers.swift.gyb index 01e664334a77b..23421afe14e89 100644 --- a/test/stdlib/Integers.swift.gyb +++ b/test/stdlib/Integers.swift.gyb @@ -20,7 +20,6 @@ // REQUIRES: OS=macosx %{ -from __future__ import division word_bits = int(WORD_BITS) // 2 from SwiftIntTypes import all_integer_types }% diff --git a/test/stdlib/NumericParsing.swift.gyb b/test/stdlib/NumericParsing.swift.gyb index 80bbc6a6c4fe2..26c3a87e6957c 100644 --- a/test/stdlib/NumericParsing.swift.gyb +++ b/test/stdlib/NumericParsing.swift.gyb @@ -17,7 +17,6 @@ // RUN: %line-directive %t/NumericParsing.swift -- %target-run %t/a.out // REQUIRES: executable_test %{ -from __future__ import division from SwiftIntTypes import all_integer_types word_bits = int(CMAKE_SIZEOF_VOID_P) diff --git a/test/stdlib/SIMDConcreteIntegers.swift.gyb b/test/stdlib/SIMDConcreteIntegers.swift.gyb index 6da7be1fb53c5..50c1274235afe 100644 --- a/test/stdlib/SIMDConcreteIntegers.swift.gyb +++ b/test/stdlib/SIMDConcreteIntegers.swift.gyb @@ -20,7 +20,6 @@ import StdlibUnittest %{ -from __future__ import division from SwiftIntTypes import all_integer_types word_bits = int(CMAKE_SIZEOF_VOID_P) * 8 storagescalarCounts = [2,4,8,16,32,64] diff --git a/test/stdlib/SIMDConcreteMasks.swift.gyb b/test/stdlib/SIMDConcreteMasks.swift.gyb index 930e27052ba00..ccead5fb6bc81 100644 --- a/test/stdlib/SIMDConcreteMasks.swift.gyb +++ b/test/stdlib/SIMDConcreteMasks.swift.gyb @@ -20,7 +20,6 @@ import StdlibUnittest %{ -from __future__ import division from SwiftIntTypes import all_integer_types word_bits = int(CMAKE_SIZEOF_VOID_P) * 8 storagescalarCounts = [2,4,8,16,32,64] diff --git a/tools/swift-inspect/build_script_helper.py b/tools/swift-inspect/build_script_helper.py index ae9b9c9747f2c..d11e254d53c2d 100755 --- a/tools/swift-inspect/build_script_helper.py +++ b/tools/swift-inspect/build_script_helper.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import os diff --git a/utils/80+-check b/utils/80+-check index 34d0f9563b08c..9431818fa7d65 100755 --- a/utils/80+-check +++ b/utils/80+-check @@ -1,8 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 -from __future__ import print_function, unicode_literals - import argparse import sys diff --git a/utils/PathSanitizingFileCheck b/utils/PathSanitizingFileCheck index 030fe04fdb2b0..d1bab9553be1b 100755 --- a/utils/PathSanitizingFileCheck +++ b/utils/PathSanitizingFileCheck @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/PathSanitizingFileCheck -*- python -*- # # This source file is part of the Swift.org open source project @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import argparse import io import re diff --git a/utils/analyze_code_size.py b/utils/analyze_code_size.py index 3e84cf18ff01d..30b6278b9a88f 100755 --- a/utils/analyze_code_size.py +++ b/utils/analyze_code_size.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import re diff --git a/utils/android/adb/commands.py b/utils/android/adb/commands.py index 87b5f08d60fb5..f7bf0680e79e8 100644 --- a/utils/android/adb/commands.py +++ b/utils/android/adb/commands.py @@ -15,8 +15,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import subprocess import tempfile diff --git a/utils/android/adb_clean.py b/utils/android/adb_clean.py index bba251e6abe1b..abda976b2367b 100644 --- a/utils/android/adb_clean.py +++ b/utils/android/adb_clean.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # adb_reboot.py - Reboots and cleans an Android device. -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/utils/android/adb_push_built_products.py b/utils/android/adb_push_built_products.py index e6b0e3eb62141..17bf3bbd08955 100755 --- a/utils/android/adb_push_built_products.py +++ b/utils/android/adb_push_built_products.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # adb_push_build_products.py - Push libraries to Android device -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/utils/android/adb_push_built_products/main.py b/utils/android/adb_push_built_products/main.py index e5017ef3ac696..d9977d2eeabf4 100644 --- a/utils/android/adb_push_built_products/main.py +++ b/utils/android/adb_push_built_products/main.py @@ -15,8 +15,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import argparse import glob import os diff --git a/utils/android/adb_test_runner.py b/utils/android/adb_test_runner.py index d67e97e80b285..8306fac4f1ff1 100755 --- a/utils/android/adb_test_runner.py +++ b/utils/android/adb_test_runner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # adb_test_runner.py - Calls adb_test_runner.main -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/utils/android/adb_test_runner/main.py b/utils/android/adb_test_runner/main.py index 0ab33b8469280..642ba58539502 100644 --- a/utils/android/adb_test_runner/main.py +++ b/utils/android/adb_test_runner/main.py @@ -17,8 +17,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import sys diff --git a/utils/api_checker/sdk-module-lists/infer-imports.py b/utils/api_checker/sdk-module-lists/infer-imports.py index c85348db9bcce..8086507f0300b 100755 --- a/utils/api_checker/sdk-module-lists/infer-imports.py +++ b/utils/api_checker/sdk-module-lists/infer-imports.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -u -from __future__ import print_function - import os import sys diff --git a/utils/api_checker/swift-api-checker.py b/utils/api_checker/swift-api-checker.py index c2c889da904f8..cfd272c42d3e7 100755 --- a/utils/api_checker/swift-api-checker.py +++ b/utils/api_checker/swift-api-checker.py @@ -1,7 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function - import argparse import os import subprocess diff --git a/utils/apply-fixit-edits.py b/utils/apply-fixit-edits.py index adcc92fcb32c6..6806af061d528 100755 --- a/utils/apply-fixit-edits.py +++ b/utils/apply-fixit-edits.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/apply-fixit-edits.py - Apply edits from .remap files -*- python -*- # # This source file is part of the Swift.org open source project @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import argparse import collections import json diff --git a/utils/backtrace-check b/utils/backtrace-check index a8058cff27b46..350992b4374a7 100755 --- a/utils/backtrace-check +++ b/utils/backtrace-check @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ @@ -22,8 +22,6 @@ StaticString, StaticString, UInt, flags : UInt32) -> () + 444 """ -from __future__ import absolute_import, print_function, unicode_literals - import argparse import re import sys diff --git a/utils/bug_reducer/bug_reducer/bug_reducer.py b/utils/bug_reducer/bug_reducer/bug_reducer.py index 9181fcae468c6..01510d33aacc2 100755 --- a/utils/bug_reducer/bug_reducer/bug_reducer.py +++ b/utils/bug_reducer/bug_reducer/bug_reducer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse diff --git a/utils/bug_reducer/bug_reducer/func_bug_reducer.py b/utils/bug_reducer/bug_reducer/func_bug_reducer.py index 83c41e2c0281c..1fcc9ba6edbe7 100644 --- a/utils/bug_reducer/bug_reducer/func_bug_reducer.py +++ b/utils/bug_reducer/bug_reducer/func_bug_reducer.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import md5 import os import sys diff --git a/utils/bug_reducer/bug_reducer/list_reducer.py b/utils/bug_reducer/bug_reducer/list_reducer.py index 0d15dfa66ec08..6940e0a566b65 100644 --- a/utils/bug_reducer/bug_reducer/list_reducer.py +++ b/utils/bug_reducer/bug_reducer/list_reducer.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import random TESTRESULT_NOFAILURE = "NoFailure" diff --git a/utils/bug_reducer/bug_reducer/opt_bug_reducer.py b/utils/bug_reducer/bug_reducer/opt_bug_reducer.py index b184063f8ae23..4ef9223bcfcf5 100644 --- a/utils/bug_reducer/bug_reducer/opt_bug_reducer.py +++ b/utils/bug_reducer/bug_reducer/opt_bug_reducer.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import json import md5 import subprocess diff --git a/utils/bug_reducer/bug_reducer/random_bug_finder.py b/utils/bug_reducer/bug_reducer/random_bug_finder.py index 37273e41a7658..a72343e8560d5 100644 --- a/utils/bug_reducer/bug_reducer/random_bug_finder.py +++ b/utils/bug_reducer/bug_reducer/random_bug_finder.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import json import random import subprocess diff --git a/utils/bug_reducer/bug_reducer/swift_tools.py b/utils/bug_reducer/bug_reducer/swift_tools.py index a657c0635b89d..38497ace952aa 100644 --- a/utils/bug_reducer/bug_reducer/swift_tools.py +++ b/utils/bug_reducer/bug_reducer/swift_tools.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import os import subprocess diff --git a/utils/build-script b/utils/build-script index 2e56ff6816f99..10bdfbc3e0624 100755 --- a/utils/build-script +++ b/utils/build-script @@ -14,8 +14,6 @@ The ultimate tool for building Swift. """ -from __future__ import absolute_import, print_function, unicode_literals - import json import os import platform diff --git a/utils/build-tooling-libs b/utils/build-tooling-libs index db8e192c0b7de..97e7230bc6ab8 100755 --- a/utils/build-tooling-libs +++ b/utils/build-tooling-libs @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/build-tooling-libs - Helper tool for building the SwiftSyntax paresr # and SwiftStaticMirror libraries -*- python -*- # @@ -23,8 +23,6 @@ # This utility also provides capability to gather profile data and build the parser # library with PGO optimization enabled. -from __future__ import print_function - import copy import multiprocessing import os diff --git a/utils/build_swift/build_swift/argparse/__init__.py b/utils/build_swift/build_swift/argparse/__init__.py index 299363efab37b..2213ac7ad748f 100644 --- a/utils/build_swift/build_swift/argparse/__init__.py +++ b/utils/build_swift/build_swift/argparse/__init__.py @@ -14,8 +14,6 @@ super-set of the argparse API and is meant to be used as a drop-in replacement. """ -from __future__ import absolute_import, unicode_literals - from argparse import (ArgumentDefaultsHelpFormatter, ArgumentError, ArgumentTypeError, FileType, HelpFormatter, Namespace, RawDescriptionHelpFormatter, diff --git a/utils/build_swift/build_swift/argparse/actions.py b/utils/build_swift/build_swift/argparse/actions.py index a9f402cf63bcd..a0cf232cbcf31 100644 --- a/utils/build_swift/build_swift/argparse/actions.py +++ b/utils/build_swift/build_swift/argparse/actions.py @@ -13,8 +13,6 @@ """ -from __future__ import absolute_import, unicode_literals - import argparse import copy diff --git a/utils/build_swift/build_swift/argparse/parser.py b/utils/build_swift/build_swift/argparse/parser.py index 4957438d6ba0d..268fbd68de588 100644 --- a/utils/build_swift/build_swift/argparse/parser.py +++ b/utils/build_swift/build_swift/argparse/parser.py @@ -13,9 +13,6 @@ constructing complex parsers. """ - -from __future__ import absolute_import, unicode_literals - import argparse from contextlib import contextmanager diff --git a/utils/build_swift/build_swift/argparse/types.py b/utils/build_swift/build_swift/argparse/types.py index fac0e599aef62..51327ee8d27bf 100644 --- a/utils/build_swift/build_swift/argparse/types.py +++ b/utils/build_swift/build_swift/argparse/types.py @@ -13,8 +13,6 @@ """ -from __future__ import absolute_import, unicode_literals - import os.path import re import shlex diff --git a/utils/build_swift/build_swift/cache_utils.py b/utils/build_swift/build_swift/cache_utils.py index ede762d7d2c78..2b0de89679e2e 100644 --- a/utils/build_swift/build_swift/cache_utils.py +++ b/utils/build_swift/build_swift/cache_utils.py @@ -11,9 +11,6 @@ Cache related utitlity functions and decorators. """ - -from __future__ import absolute_import, unicode_literals - import functools diff --git a/utils/build_swift/build_swift/class_utils.py b/utils/build_swift/build_swift/class_utils.py index 411e57cdefe3c..5c45daf01ca54 100644 --- a/utils/build_swift/build_swift/class_utils.py +++ b/utils/build_swift/build_swift/class_utils.py @@ -12,9 +12,6 @@ """ -from __future__ import absolute_import, unicode_literals - - __all__ = [ 'generate_repr', ] diff --git a/utils/build_swift/build_swift/constants.py b/utils/build_swift/build_swift/constants.py index 70c6d57369fb9..9de8475b262ff 100644 --- a/utils/build_swift/build_swift/constants.py +++ b/utils/build_swift/build_swift/constants.py @@ -6,11 +6,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors - -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import os.path diff --git a/utils/build_swift/build_swift/defaults.py b/utils/build_swift/build_swift/defaults.py index e0950efb76643..d35c1ce6a3f8c 100644 --- a/utils/build_swift/build_swift/defaults.py +++ b/utils/build_swift/build_swift/defaults.py @@ -11,9 +11,6 @@ Default option value definitions. """ - -from __future__ import absolute_import, unicode_literals - import os import platform diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index 011ff48c25fa3..e810261928a0d 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -6,9 +6,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors - -from __future__ import absolute_import, unicode_literals - import multiprocessing import os diff --git a/utils/build_swift/build_swift/migration.py b/utils/build_swift/build_swift/migration.py index a6fb00c6e4d40..dc6e0823647b9 100644 --- a/utils/build_swift/build_swift/migration.py +++ b/utils/build_swift/build_swift/migration.py @@ -12,8 +12,6 @@ """ -from __future__ import absolute_import, unicode_literals - import itertools import subprocess diff --git a/utils/build_swift/build_swift/presets.py b/utils/build_swift/build_swift/presets.py index 06086f16babb1..afb77bdaba03d 100644 --- a/utils/build_swift/build_swift/presets.py +++ b/utils/build_swift/build_swift/presets.py @@ -12,8 +12,6 @@ """ -from __future__ import absolute_import, unicode_literals - import configparser import functools import io diff --git a/utils/build_swift/build_swift/shell.py b/utils/build_swift/build_swift/shell.py index 28c25ee0b49f6..6ed0082cf70ca 100644 --- a/utils/build_swift/build_swift/shell.py +++ b/utils/build_swift/build_swift/shell.py @@ -12,8 +12,6 @@ """ -from __future__ import absolute_import, unicode_literals - import abc import collections import functools diff --git a/utils/build_swift/build_swift/versions.py b/utils/build_swift/build_swift/versions.py index 27285f840cad7..0a2e689226a2d 100644 --- a/utils/build_swift/build_swift/versions.py +++ b/utils/build_swift/build_swift/versions.py @@ -12,8 +12,6 @@ """ -from __future__ import absolute_import, unicode_literals - import functools diff --git a/utils/build_swift/build_swift/wrappers/__init__.py b/utils/build_swift/build_swift/wrappers/__init__.py index 0b613c3f6a7a9..5fdd568b8f326 100644 --- a/utils/build_swift/build_swift/wrappers/__init__.py +++ b/utils/build_swift/build_swift/wrappers/__init__.py @@ -6,9 +6,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors - -from __future__ import absolute_import, unicode_literals - from . import xcrun as _xcrun diff --git a/utils/build_swift/build_swift/wrappers/xcrun.py b/utils/build_swift/build_swift/wrappers/xcrun.py index d89e798857410..3f1e584178751 100644 --- a/utils/build_swift/build_swift/wrappers/xcrun.py +++ b/utils/build_swift/build_swift/wrappers/xcrun.py @@ -11,9 +11,6 @@ Wrapper module around the 'xcrun' command-line utility. """ - -from __future__ import absolute_import, unicode_literals - import functools import re import shlex diff --git a/utils/build_swift/run_tests.py b/utils/build_swift/run_tests.py index 0cfade6422484..4439b29c0f132 100644 --- a/utils/build_swift/run_tests.py +++ b/utils/build_swift/run_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This source file is part of the Swift.org open source project # @@ -14,8 +14,6 @@ """ -from __future__ import absolute_import, unicode_literals - import argparse import os import sys diff --git a/utils/build_swift/tests/build_swift/argparse/test_actions.py b/utils/build_swift/tests/build_swift/argparse/test_actions.py index bdb53de2728b8..48ffe05b4c743 100644 --- a/utils/build_swift/tests/build_swift/argparse/test_actions.py +++ b/utils/build_swift/tests/build_swift/argparse/test_actions.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import unittest from build_swift.argparse import ( diff --git a/utils/build_swift/tests/build_swift/argparse/test_parser.py b/utils/build_swift/tests/build_swift/argparse/test_parser.py index caf23dd74768e..53897481f0649 100644 --- a/utils/build_swift/tests/build_swift/argparse/test_parser.py +++ b/utils/build_swift/tests/build_swift/argparse/test_parser.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import unittest from argparse import _ArgumentGroup, _MutuallyExclusiveGroup diff --git a/utils/build_swift/tests/build_swift/argparse/test_types.py b/utils/build_swift/tests/build_swift/argparse/test_types.py index bb9c3e72d544a..dd5aaf784100c 100644 --- a/utils/build_swift/tests/build_swift/argparse/test_types.py +++ b/utils/build_swift/tests/build_swift/argparse/test_types.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import os.path import platform import unittest diff --git a/utils/build_swift/tests/build_swift/test_cache_utils.py b/utils/build_swift/tests/build_swift/test_cache_utils.py index d9fa4b216d75e..38a9391fe74e0 100644 --- a/utils/build_swift/tests/build_swift/test_cache_utils.py +++ b/utils/build_swift/tests/build_swift/test_cache_utils.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import unittest from build_swift import cache_utils diff --git a/utils/build_swift/tests/build_swift/test_constants.py b/utils/build_swift/tests/build_swift/test_constants.py index 847a7fe34f2b0..5fb7aba0ee3b5 100644 --- a/utils/build_swift/tests/build_swift/test_constants.py +++ b/utils/build_swift/tests/build_swift/test_constants.py @@ -7,9 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import -from __future__ import unicode_literals - import os.path import unittest diff --git a/utils/build_swift/tests/build_swift/test_defaults.py b/utils/build_swift/tests/build_swift/test_defaults.py index 0e38ba868d620..965c2f56c9f36 100644 --- a/utils/build_swift/tests/build_swift/test_defaults.py +++ b/utils/build_swift/tests/build_swift/test_defaults.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import unittest from build_swift import defaults diff --git a/utils/build_swift/tests/build_swift/test_driver_arguments.py b/utils/build_swift/tests/build_swift/test_driver_arguments.py index 85a6eb2a71c1c..ac266988a53dd 100644 --- a/utils/build_swift/tests/build_swift/test_driver_arguments.py +++ b/utils/build_swift/tests/build_swift/test_driver_arguments.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import os import platform import sys diff --git a/utils/build_swift/tests/build_swift/test_migration.py b/utils/build_swift/tests/build_swift/test_migration.py index bca9b2acb177e..1377ce8b285cd 100644 --- a/utils/build_swift/tests/build_swift/test_migration.py +++ b/utils/build_swift/tests/build_swift/test_migration.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import platform import unittest diff --git a/utils/build_swift/tests/build_swift/test_presets.py b/utils/build_swift/tests/build_swift/test_presets.py index f142cbf35574d..0aee6ec867f51 100644 --- a/utils/build_swift/tests/build_swift/test_presets.py +++ b/utils/build_swift/tests/build_swift/test_presets.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import unicode_literals - import configparser import os import unittest diff --git a/utils/build_swift/tests/build_swift/test_shell.py b/utils/build_swift/tests/build_swift/test_shell.py index 25e5da2e877b4..eb55ad0e5fdc6 100644 --- a/utils/build_swift/tests/build_swift/test_shell.py +++ b/utils/build_swift/tests/build_swift/test_shell.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import builtins import collections import sys diff --git a/utils/build_swift/tests/build_swift/test_versions.py b/utils/build_swift/tests/build_swift/test_versions.py index 51e3c5076b53a..53a2aee43d3d4 100644 --- a/utils/build_swift/tests/build_swift/test_versions.py +++ b/utils/build_swift/tests/build_swift/test_versions.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import unittest from build_swift.versions import Version diff --git a/utils/build_swift/tests/build_swift/wrappers/test_xcrun.py b/utils/build_swift/tests/build_swift/wrappers/test_xcrun.py index 858101aac61f3..7270df19b199d 100644 --- a/utils/build_swift/tests/build_swift/wrappers/test_xcrun.py +++ b/utils/build_swift/tests/build_swift/wrappers/test_xcrun.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import os.path import unittest diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index 4ef8b307b9ede..c251d54b38e31 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import multiprocessing from build_swift import argparse diff --git a/utils/build_swift/tests/utils.py b/utils/build_swift/tests/utils.py index b4001ad728662..275f97de7b071 100644 --- a/utils/build_swift/tests/utils.py +++ b/utils/build_swift/tests/utils.py @@ -7,8 +7,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import functools import os import platform diff --git a/utils/check_freestanding_dependencies.py b/utils/check_freestanding_dependencies.py index a420a4f07a0af..cd87c651e7591 100755 --- a/utils/check_freestanding_dependencies.py +++ b/utils/check_freestanding_dependencies.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This source file is part of the Swift.org open source project # diff --git a/utils/check_freestanding_size.py b/utils/check_freestanding_size.py index d30b16018af11..cde8912d17878 100755 --- a/utils/check_freestanding_size.py +++ b/utils/check_freestanding_size.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This source file is part of the Swift.org open source project # diff --git a/utils/chex.py b/utils/chex.py index e84b1fa10e581..f66c7beff9d70 100755 --- a/utils/chex.py +++ b/utils/chex.py @@ -1,11 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check HEX -- a stupid filter that allows hexadecimal literals to be checked # for in LLVM IR FileCheck tests. It works by replacing occurrences of # strings matching the regex /< (i[0-9]+) \s+ (0x[0-9A-Fa-f]+) >/x with the # decimal literal equivalent that would really appear in printed LLVM IR. -from __future__ import print_function - import re import sys diff --git a/utils/cmpcodesize/cmpcodesize.py b/utils/cmpcodesize/cmpcodesize.py index 777e835804b61..0b9a8401c1f51 100755 --- a/utils/cmpcodesize/cmpcodesize.py +++ b/utils/cmpcodesize/cmpcodesize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # cmpcodesize.py - Compare sizes of built products -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/utils/cmpcodesize/cmpcodesize/compare.py b/utils/cmpcodesize/cmpcodesize/compare.py index 3c4f720e3c2d7..207ec16cd0e34 100644 --- a/utils/cmpcodesize/cmpcodesize/compare.py +++ b/utils/cmpcodesize/cmpcodesize/compare.py @@ -8,8 +8,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import collections import os import re diff --git a/utils/cmpcodesize/cmpcodesize/main.py b/utils/cmpcodesize/cmpcodesize/main.py index aebf456dec54b..56a6fa645588f 100644 --- a/utils/cmpcodesize/cmpcodesize/main.py +++ b/utils/cmpcodesize/cmpcodesize/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # cmpcodesize/main.py - Command-line entry point for cmpcodesize -*- python -*- # # This source file is part of the Swift.org open source project @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import argparse import collections import csv diff --git a/utils/coverage/coverage-build-db b/utils/coverage/coverage-build-db index d37fee452c663..6a6fd82d83f72 100755 --- a/utils/coverage/coverage-build-db +++ b/utils/coverage/coverage-build-db @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/coverage/coverage-build-db - Build sqlite3 database from profdata # # This source file is part of the Swift.org open source project diff --git a/utils/coverage/coverage-generate-data b/utils/coverage/coverage-generate-data index 947a26f107ea7..9102b8cd7c915 100755 --- a/utils/coverage/coverage-generate-data +++ b/utils/coverage/coverage-generate-data @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/coverage/coverage-generate-data - Generate, parse test run profdata # # This source file is part of the Swift.org open source project diff --git a/utils/coverage/coverage-query-db b/utils/coverage/coverage-query-db index fca803088ed2e..293902ac57fae 100755 --- a/utils/coverage/coverage-query-db +++ b/utils/coverage/coverage-query-db @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/coverage/coverage-query-db - Find covering tests using coverage # database # diff --git a/utils/coverage/coverage-touch-tests b/utils/coverage/coverage-touch-tests index ef43dbfa94ae3..f315568712bc7 100755 --- a/utils/coverage/coverage-touch-tests +++ b/utils/coverage/coverage-touch-tests @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/coverage/coverage-touch-tests - Touch tests covering git changes # # This source file is part of the Swift.org open source project @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import argparse import logging import multiprocessing diff --git a/utils/create-filecheck-test.py b/utils/create-filecheck-test.py index 03f012ed3c542..77b52155a4edb 100755 --- a/utils/create-filecheck-test.py +++ b/utils/create-filecheck-test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # The following script takes as input a SIL fragment and changes all # SSA variables into FileCheck variables. This significantly reduces diff --git a/utils/dev-scripts/blockifyasm b/utils/dev-scripts/blockifyasm index fe0c525fdd6ba..62803851cb233 100755 --- a/utils/dev-scripts/blockifyasm +++ b/utils/dev-scripts/blockifyasm @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # blockifyasm ----- Split disassembly into basic blocks ---------*- python -*- # # This source file is part of the Swift.org open source project @@ -22,8 +22,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import re import sys from collections import defaultdict diff --git a/utils/dev-scripts/csvcolumn_to_scurve.py b/utils/dev-scripts/csvcolumn_to_scurve.py index 8ec698e9d290b..55d852b563499 100755 --- a/utils/dev-scripts/csvcolumn_to_scurve.py +++ b/utils/dev-scripts/csvcolumn_to_scurve.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This is a simple script that reads in a csv file, selects a column, and then # forms an "s-curve" graph of that column. diff --git a/utils/dev-scripts/scurve_printer.py b/utils/dev-scripts/scurve_printer.py index 2fea67331cd01..1a77477dc591f 100755 --- a/utils/dev-scripts/scurve_printer.py +++ b/utils/dev-scripts/scurve_printer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This is a simple script that takes in an scurve file produced by # csvcolumn_to_scurve and produces a png graph of the scurve. diff --git a/utils/dev-scripts/split-cmdline b/utils/dev-scripts/split-cmdline index cf92fc333894f..c1a14599454ea 100755 --- a/utils/dev-scripts/split-cmdline +++ b/utils/dev-scripts/split-cmdline @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # split-cmdline - Split swift compiler command lines ------------*- python -*- # # This source file is part of the Swift.org open source project @@ -36,8 +36,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import re import shlex diff --git a/utils/generate_confusables.py b/utils/generate_confusables.py index 1821ae4a64370..5a08347ec26b1 100755 --- a/utils/generate_confusables.py +++ b/utils/generate_confusables.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # utils/update_confusables.py - Utility to update definitions of unicode # confusables diff --git a/utils/gyb.py b/utils/gyb.py index c0349cc9ce207..7b570ac758c54 100755 --- a/utils/gyb.py +++ b/utils/gyb.py @@ -2,8 +2,6 @@ # GYB: Generate Your Boilerplate (improved names welcome; at least # this one's short). See -h output for instructions -from __future__ import print_function - import io import os import re diff --git a/utils/gyb_syntax_support/Node.py b/utils/gyb_syntax_support/Node.py index d9f2b41dd0e5a..8e2b15318cff7 100644 --- a/utils/gyb_syntax_support/Node.py +++ b/utils/gyb_syntax_support/Node.py @@ -1,4 +1,3 @@ -from __future__ import print_function import sys # noqa: I201 from .kinds import SYNTAX_BASE_KINDS, kind_to_type, lowercase_first_word diff --git a/utils/gyb_syntax_support/Traits.py b/utils/gyb_syntax_support/Traits.py index a45c5babb1e0a..382657dfa734f 100644 --- a/utils/gyb_syntax_support/Traits.py +++ b/utils/gyb_syntax_support/Traits.py @@ -1,4 +1,4 @@ -from Child import Child +from .Child import Child class Trait(object): diff --git a/utils/incrparse/incr_transfer_round_trip.py b/utils/incrparse/incr_transfer_round_trip.py index 82142c4435805..ca7a1478acbf9 100755 --- a/utils/incrparse/incr_transfer_round_trip.py +++ b/utils/incrparse/incr_transfer_round_trip.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import os diff --git a/utils/incrparse/test_util.py b/utils/incrparse/test_util.py index 692672754574d..654887b12efde 100755 --- a/utils/incrparse/test_util.py +++ b/utils/incrparse/test_util.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import io diff --git a/utils/incrparse/validate_parse.py b/utils/incrparse/validate_parse.py index c000b71b98215..826c2e7e2eb34 100755 --- a/utils/incrparse/validate_parse.py +++ b/utils/incrparse/validate_parse.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import difflib diff --git a/utils/jobstats/__init__.py b/utils/jobstats/__init__.py index 20b909c9baec3..e9e67145f48f0 100644 --- a/utils/jobstats/__init__.py +++ b/utils/jobstats/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # ==-- jobstats - support for reading the contents of stats dirs --==# # diff --git a/utils/jobstats/jobstats.py b/utils/jobstats/jobstats.py index c6fd1ed10ff31..4acce6874ea7f 100644 --- a/utils/jobstats/jobstats.py +++ b/utils/jobstats/jobstats.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # ==-- jobstats - support for reading the contents of stats dirs --==# # diff --git a/utils/line-directive b/utils/line-directive index 13e8988969e54..5064c3d73d35e 100755 --- a/utils/line-directive +++ b/utils/line-directive @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # line-directive.py - Transform line numbers in error messages -*- python -*- # # This source file is part of the Swift.org open source project @@ -10,8 +10,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors # # ---------------------------------------------------------------------------- -from __future__ import print_function - import bisect import io import os diff --git a/utils/lldb/lldbCheckExpect.py b/utils/lldb/lldbCheckExpect.py index dadd18d3c536b..12a54559e9e90 100644 --- a/utils/lldb/lldbCheckExpect.py +++ b/utils/lldb/lldbCheckExpect.py @@ -21,7 +21,6 @@ Expected value : 98 Actual value : ... ''' -from __future__ import print_function def unwrap(s): diff --git a/utils/lldb/lldbToolBox.py b/utils/lldb/lldbToolBox.py index 8ec2c705c0147..f0f944940d4df 100644 --- a/utils/lldb/lldbToolBox.py +++ b/utils/lldb/lldbToolBox.py @@ -6,8 +6,6 @@ This will also import LLVM data formatters as well, assuming that llvm is next to the swift checkout. """ -from __future__ import print_function - import argparse import os import shlex diff --git a/utils/optimizer_counters_to_sql.py b/utils/optimizer_counters_to_sql.py index 03bf3de15dfb4..2a5d3e3cc70d2 100755 --- a/utils/optimizer_counters_to_sql.py +++ b/utils/optimizer_counters_to_sql.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # optimizer_counters_to_sql.py - Store CSV counters into SQLite -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/utils/pass-pipeline/scripts/pipeline_generator.py b/utils/pass-pipeline/scripts/pipeline_generator.py index 86672cb4f9a77..fd8f4b913e5d4 100755 --- a/utils/pass-pipeline/scripts/pipeline_generator.py +++ b/utils/pass-pipeline/scripts/pipeline_generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import json diff --git a/utils/pass-pipeline/scripts/pipelines_build_script.py b/utils/pass-pipeline/scripts/pipelines_build_script.py index 1a482de85aa7c..fdce43129c3f0 100755 --- a/utils/pass-pipeline/scripts/pipelines_build_script.py +++ b/utils/pass-pipeline/scripts/pipelines_build_script.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import os diff --git a/utils/process-stats-dir.py b/utils/process-stats-dir.py index d6c933455b400..dd06dbe7b049e 100755 --- a/utils/process-stats-dir.py +++ b/utils/process-stats-dir.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # ==-- process-stats-dir - summarize one or more Swift -stats-output-dirs --==# # diff --git a/utils/protocol_graph.py b/utils/protocol_graph.py index f237f654b9013..7d4e0770e0a3d 100644 --- a/utils/protocol_graph.py +++ b/utils/protocol_graph.py @@ -23,8 +23,6 @@ # # ===---------------------------------------------------------------------===// -from __future__ import print_function - import cgi import os import re diff --git a/utils/pygments/swift.py b/utils/pygments/swift.py index 59587e0b7e036..838c6fa63248a 100755 --- a/utils/pygments/swift.py +++ b/utils/pygments/swift.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import re diff --git a/utils/python_lint.py b/utils/python_lint.py index 260761a4bca2b..708d48f3da710 100755 --- a/utils/python_lint.py +++ b/utils/python_lint.py @@ -16,8 +16,6 @@ """ -from __future__ import absolute_import, print_function, unicode_literals - import os import subprocess import sys diff --git a/utils/recursive-lipo b/utils/recursive-lipo index a4aa4bc5b5f27..8b4590a4b792a 100755 --- a/utils/recursive-lipo +++ b/utils/recursive-lipo @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import filecmp diff --git a/utils/refactor-check-compiles.py b/utils/refactor-check-compiles.py index b2912f725164e..9794174e12877 100755 --- a/utils/refactor-check-compiles.py +++ b/utils/refactor-check-compiles.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -from __future__ import print_function - +#!/usr/bin/env python3 import argparse import os import subprocess diff --git a/utils/remote-run b/utils/remote-run index d9776d8a1e5d6..1f3c2a617ce48 100755 --- a/utils/remote-run +++ b/utils/remote-run @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # remote-run - Runs a command on another machine, for testing -----*- python -*- # # This source file is part of the Swift.org open source project @@ -11,8 +11,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import argparse import os import posixpath diff --git a/utils/resolve-crashes.py b/utils/resolve-crashes.py index e716c63fcc568..e14d7e59e5142 100755 --- a/utils/resolve-crashes.py +++ b/utils/resolve-crashes.py @@ -1,11 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # A small utility to take the output of a Swift validation test run # where some compiler crashers have been fixed, and move them into the # "fixed" testsuite, removing the "--crash" in the process. -from __future__ import print_function - import os import re import sys diff --git a/utils/round-trip-syntax-test b/utils/round-trip-syntax-test index 808cceab22df9..c1b1cdf6c385d 100755 --- a/utils/round-trip-syntax-test +++ b/utils/round-trip-syntax-test @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function, unicode_literals +#!/usr/bin/env python3 import argparse import difflib diff --git a/utils/rth b/utils/rth index 36852b9eba5bf..9c1b582e19da9 100755 --- a/utils/rth +++ b/utils/rth @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/rth - Resilience test helper # # This source file is part of the Swift.org open source project @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import argparse import glob import os diff --git a/utils/run-test b/utils/run-test index 9e1fafab51e0f..2516af25381a3 100755 --- a/utils/run-test +++ b/utils/run-test @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import multiprocessing import os import shutil diff --git a/utils/rusage.py b/utils/rusage.py index 7dda698fca542..594ab5d04d142 100755 --- a/utils/rusage.py +++ b/utils/rusage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/rusage.py - Utility to measure resource usage -*- python -*- # # This source file is part of the Swift.org open source project diff --git a/utils/scale-test b/utils/scale-test index 8a825919a59f6..a48d745705e84 100755 --- a/utils/scale-test +++ b/utils/scale-test @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # -*- python -*- # @@ -12,8 +12,6 @@ # values. # -from __future__ import print_function - import argparse import functools import io diff --git a/utils/sil-opt-verify-all-modules.py b/utils/sil-opt-verify-all-modules.py index f2fb96af00afe..ccb295099b8f0 100755 --- a/utils/sil-opt-verify-all-modules.py +++ b/utils/sil-opt-verify-all-modules.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # utils/sil-opt-verify-all-modules.py - Verifies Swift modules -*- python -*- # # This source file is part of the Swift.org open source project @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import argparse import glob import multiprocessing diff --git a/utils/split_file.py b/utils/split_file.py index 5564e61f5bb63..3ef7d10f440f8 100755 --- a/utils/split_file.py +++ b/utils/split_file.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This source file is part of the Swift.org open source project # diff --git a/utils/submit-benchmark-results b/utils/submit-benchmark-results index 42443e81ccd8c..d697fe529d443 100644 --- a/utils/submit-benchmark-results +++ b/utils/submit-benchmark-results @@ -1,9 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Utility script for submitting benchmark results to an LNT server.""" -from __future__ import print_function - import datetime import errno import json diff --git a/utils/swift-api-dump.py b/utils/swift-api-dump.py index ecffb3cbef071..731218861d1a2 100755 --- a/utils/swift-api-dump.py +++ b/utils/swift-api-dump.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This tool dumps imported Swift APIs to help validate changes in the # projection of (Objective-)C APIs into Swift, which is a function of the @@ -21,8 +21,6 @@ # -s macosx iphoneos watchos appletvos # -from __future__ import print_function - import argparse import multiprocessing import os diff --git a/utils/swift-bench.py b/utils/swift-bench.py index a61b1de0c814b..6302d2252af29 100644 --- a/utils/swift-bench.py +++ b/utils/swift-bench.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ===--- swift-bench.py ------------------------------*- coding: utf-8 -*-===// # # This source file is part of the Swift.org open source project @@ -32,8 +32,6 @@ # Ideas for the harness improvement and development are welcomed here: # rdar://problem/18072938 -from __future__ import print_function - import argparse import math import os diff --git a/utils/swift-rpathize.py b/utils/swift-rpathize.py index 8c310697f1b41..a80580f518818 100755 --- a/utils/swift-rpathize.py +++ b/utils/swift-rpathize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # On Darwin, dynamic libraries have an install name. At link time, the # linker can work with a dylib anywhere in the filesystem, but it will diff --git a/utils/swift_build_sdk_interfaces.py b/utils/swift_build_sdk_interfaces.py index 3fe3e0f2e1776..3904c561ef6de 100755 --- a/utils/swift_build_sdk_interfaces.py +++ b/utils/swift_build_sdk_interfaces.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python - -from __future__ import print_function +#!/usr/bin/env python3 import argparse import errno diff --git a/utils/swift_build_support/run_tests.py b/utils/swift_build_support/run_tests.py index 424044ed0b602..441a64f872ab8 100644 --- a/utils/swift_build_support/run_tests.py +++ b/utils/swift_build_support/run_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This source file is part of the Swift.org open source project # @@ -14,8 +14,6 @@ """ -from __future__ import absolute_import, unicode_literals - import os import sys import unittest diff --git a/utils/swift_build_support/swift_build_support/cmake.py b/utils/swift_build_support/swift_build_support/cmake.py index 5da052e40764c..91f7e03aa34a7 100644 --- a/utils/swift_build_support/swift_build_support/cmake.py +++ b/utils/swift_build_support/swift_build_support/cmake.py @@ -15,8 +15,6 @@ # ---------------------------------------------------------------------------- -from __future__ import absolute_import, unicode_literals - import os import platform import re diff --git a/utils/swift_build_support/swift_build_support/shell.py b/utils/swift_build_support/swift_build_support/shell.py index 4ab71f5e1a541..222d540dd2c95 100644 --- a/utils/swift_build_support/swift_build_support/shell.py +++ b/utils/swift_build_support/swift_build_support/shell.py @@ -13,8 +13,6 @@ """ # ---------------------------------------------------------------------------- -from __future__ import print_function - import os import pipes import platform diff --git a/utils/swift_build_support/swift_build_support/toolchain.py b/utils/swift_build_support/swift_build_support/toolchain.py index 6e70e887921d2..bd297697428e4 100644 --- a/utils/swift_build_support/swift_build_support/toolchain.py +++ b/utils/swift_build_support/swift_build_support/toolchain.py @@ -14,8 +14,6 @@ """ # ---------------------------------------------------------------------------- -from __future__ import absolute_import - import os import platform diff --git a/utils/swift_build_support/swift_build_support/utils.py b/utils/swift_build_support/swift_build_support/utils.py index 0316424235b8b..00b29f34b7323 100644 --- a/utils/swift_build_support/swift_build_support/utils.py +++ b/utils/swift_build_support/swift_build_support/utils.py @@ -10,8 +10,6 @@ # # ===---------------------------------------------------------------------===# -from __future__ import absolute_import, print_function, unicode_literals - import sys diff --git a/utils/swift_build_support/tests/mock-distcc b/utils/swift_build_support/tests/mock-distcc index 7e63458f1ada8..cc9a7c56ad2c6 100755 --- a/utils/swift_build_support/tests/mock-distcc +++ b/utils/swift_build_support/tests/mock-distcc @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # mock-distcc - discc mock used from tests ----------------------*- python -*- # # This source file is part of the Swift.org open source project @@ -9,8 +9,6 @@ # See https://swift.org/LICENSE.txt for license information # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import print_function - import sys diff --git a/utils/swift_build_support/tests/test_build_graph.py b/utils/swift_build_support/tests/test_build_graph.py index 71121281fd65a..11ebe82c513ee 100644 --- a/utils/swift_build_support/tests/test_build_graph.py +++ b/utils/swift_build_support/tests/test_build_graph.py @@ -9,8 +9,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import unittest from swift_build_support import build_graph diff --git a/utils/swift_build_support/tests/test_cmake.py b/utils/swift_build_support/tests/test_cmake.py index 937e531d5e4c1..981b0923521f9 100644 --- a/utils/swift_build_support/tests/test_cmake.py +++ b/utils/swift_build_support/tests/test_cmake.py @@ -9,8 +9,6 @@ # See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -from __future__ import absolute_import, unicode_literals - import os import platform import unittest diff --git a/utils/symbolicate-linux-fatal b/utils/symbolicate-linux-fatal index 15c6a81923d77..2641358a86800 100755 --- a/utils/symbolicate-linux-fatal +++ b/utils/symbolicate-linux-fatal @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # symbolicate-linux-fatal - Symbolicate Linux stack traces -*- python -*- # # This source file is part of the Swift.org open source project @@ -22,8 +22,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import argparse import datetime import os diff --git a/utils/type-layout-fuzzer.py b/utils/type-layout-fuzzer.py index 7959d8f859c9a..4241b9010a940 100644 --- a/utils/type-layout-fuzzer.py +++ b/utils/type-layout-fuzzer.py @@ -1,12 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This script outputs a Swift source with randomly-generated type definitions, # which can be used for ABI or layout algorithm fuzzing. # TODO: generate types with generics, existentials, compositions -from __future__ import print_function - import random import sys diff --git a/utils/viewcfg b/utils/viewcfg index 146fc267b1f42..c579eb414f775 100755 --- a/utils/viewcfg +++ b/utils/viewcfg @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # viewcfg - A script for viewing the CFG of SIL and LLVM IR -*- python -*- # # This source file is part of the Swift.org open source project @@ -26,8 +26,6 @@ # # ---------------------------------------------------------------------------- -from __future__ import print_function - import argparse import re import subprocess diff --git a/utils/vim/swift-indent.py b/utils/vim/swift-indent.py index 590141fe21712..02b2ec1dbeef9 100644 --- a/utils/vim/swift-indent.py +++ b/utils/vim/swift-indent.py @@ -27,8 +27,6 @@ # It operates on the current, potentially unsaved buffer and does not create or # save any files. To revert a indenting, just undo. -from __future__ import print_function - import difflib import platform import subprocess diff --git a/validation-test/ParseableInterface/verify_all_overlays.py b/validation-test/ParseableInterface/verify_all_overlays.py index 51f5471374d93..fd14f95dc6a83 100755 --- a/validation-test/ParseableInterface/verify_all_overlays.py +++ b/validation-test/ParseableInterface/verify_all_overlays.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Note that this test should still "pass" when no swiftinterfaces have been # generated. @@ -18,8 +18,6 @@ # ----------------------------- # (none) -from __future__ import print_function - import os import subprocess import sys diff --git a/validation-test/SIL/verify_all_overlays.py b/validation-test/SIL/verify_all_overlays.py index f3719ad6fec52..a54aaabc57279 100755 --- a/validation-test/SIL/verify_all_overlays.py +++ b/validation-test/SIL/verify_all_overlays.py @@ -8,8 +8,6 @@ # REQUIRES: nonexecutable_test -from __future__ import print_function - import os import subprocess import sys diff --git a/validation-test/stdlib/FixedPoint.swift.gyb b/validation-test/stdlib/FixedPoint.swift.gyb index b7f0e3c3af8e4..effeb1006018e 100644 --- a/validation-test/stdlib/FixedPoint.swift.gyb +++ b/validation-test/stdlib/FixedPoint.swift.gyb @@ -13,7 +13,6 @@ var FixedPoint = TestSuite("FixedPoint") %{ -from __future__ import division import gyb from SwiftIntTypes import all_integer_types diff --git a/validation-test/stdlib/UnicodeTrieGenerator.gyb b/validation-test/stdlib/UnicodeTrieGenerator.gyb index c72db823c2379..709e39c058f29 100644 --- a/validation-test/stdlib/UnicodeTrieGenerator.gyb +++ b/validation-test/stdlib/UnicodeTrieGenerator.gyb @@ -2,8 +2,6 @@ # RUN: %empty-directory(%t) && %gyb %s | %FileCheck %s -from __future__ import print_function - from GYBUnicodeDataUtils import * def test_trie_generation(property_table, configure_generator=None): From f4d1c4d270b3a5a4365522fb9db85ab6594e9547 Mon Sep 17 00:00:00 2001 From: Eric Miotto <1094986+edymtt@users.noreply.github.com> Date: Fri, 6 May 2022 10:00:28 -0700 Subject: [PATCH 3/3] Use `collections.abc.Iterable` instead of `collection.Iterable` The latter is no longer present in Python 3.10+. Addresses #58714 (cherry picked from commit ed696240cf610ae7de3eb2e53c89cff83aa1e6e2) (cherry picked from commit a871329f9d2164acd685c12c84196f28e1313114) --- utils/build_swift/build_swift/shell.py | 2 +- utils/build_swift/tests/build_swift/test_shell.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/build_swift/build_swift/shell.py b/utils/build_swift/build_swift/shell.py index 6ed0082cf70ca..366aab1851694 100644 --- a/utils/build_swift/build_swift/shell.py +++ b/utils/build_swift/build_swift/shell.py @@ -206,7 +206,7 @@ def quote(command): if isinstance(command, (str,)): return _quote(command) - if isinstance(command, collections.Iterable): + if isinstance(command, collections.abc.Iterable): return ' '.join([_quote(arg) for arg in _normalize_args(command)]) raise ValueError('Invalid command type: {}'.format(type(command).__name__)) diff --git a/utils/build_swift/tests/build_swift/test_shell.py b/utils/build_swift/tests/build_swift/test_shell.py index eb55ad0e5fdc6..b179127e9b248 100644 --- a/utils/build_swift/tests/build_swift/test_shell.py +++ b/utils/build_swift/tests/build_swift/test_shell.py @@ -65,7 +65,7 @@ def duplicate(x): result = shell._flatmap(duplicate, [1, 2, 3]) - self.assertIsInstance(result, collections.Iterable) + self.assertIsInstance(result, collections.abc.Iterable) self.assertEqual(list(result), [1, 1, 2, 2, 3, 3]) # -------------------------------------------------------------------------