From 4f2e9dcf45f80adf2a9562a01be074eb1339cf7a Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 30 Jul 2021 18:35:44 -0700 Subject: [PATCH] Migrate all Python hashbangs to Python 3 Migrates all `#!/usr/bin/env python` hashbang lines to use python3. Issue: https://github.com/flutter/flutter/issues/83043 --- build/copy_info_plist.py | 2 +- build/dart/tools/dart_package_name.py | 3 ++- build/dart/tools/dart_pkg.py | 2 +- build/generate_coverage.py | 2 +- build/git_revision.py | 2 +- build/zip.py | 3 ++- ci/firebase_testlab.py | 2 +- shell/platform/fuchsia/flutter/build/asset_package.py | 3 ++- shell/platform/fuchsia/flutter/build/gen_debug_wrapper_main.py | 3 ++- sky/tools/create_ios_framework.py | 3 ++- sky/tools/create_macos_gen_snapshots.py | 3 ++- sky/tools/create_xcframework.py | 3 ++- sky/tools/dist_dart_pkg.py | 3 ++- sky/tools/flutter_gdb | 3 ++- sky/tools/install_framework_headers.py | 3 ++- sky/tools/objcopy.py | 3 ++- sky/tools/roll/patch.py | 3 ++- sky/tools/roll/roll.py | 3 ++- sky/tools/roll/utils.py | 3 ++- testing/rules/run_gradle.py | 3 ++- testing/run_tests.py | 3 ++- tools/android_illegal_imports.py | 3 ++- tools/androidx/generate_pom_file.py | 3 ++- tools/dia_dll.py | 3 ++- tools/font-subset/test.py | 2 +- tools/fuchsia/build_fuchsia_artifacts.py | 2 +- tools/fuchsia/compile_cml.py | 2 +- tools/fuchsia/copy_debug_symbols.py | 2 +- tools/fuchsia/copy_path.py | 2 +- tools/fuchsia/gather_flutter_runner_artifacts.py | 2 +- tools/fuchsia/gen_package.py | 2 +- tools/fuchsia/gen_repo.py | 2 +- tools/fuchsia/interpolate_test_suite.py | 2 +- tools/fuchsia/make_build_info.py | 2 +- tools/fuchsia/merge_and_upload_debug_symbols.py | 2 +- tools/fuchsia/parse_manifest.py | 2 +- tools/gen_android_buildconfig.py | 3 ++- tools/gen_javadoc.py | 3 ++- tools/licenses/lib/main.dart | 2 +- 39 files changed, 60 insertions(+), 39 deletions(-) diff --git a/build/copy_info_plist.py b/build/copy_info_plist.py index a87e1a8c98867..031975b37a8b4 100644 --- a/build/copy_info_plist.py +++ b/build/copy_info_plist.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/build/dart/tools/dart_package_name.py b/build/dart/tools/dart_package_name.py index 255ef5be7a13a..db8c9e93193ed 100755 --- a/build/dart/tools/dart_package_name.py +++ b/build/dart/tools/dart_package_name.py @@ -1,4 +1,5 @@ -#!/usr/bin/python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/build/dart/tools/dart_pkg.py b/build/dart/tools/dart_pkg.py index 18d2e6951faf8..15c29cd7bace9 100755 --- a/build/dart/tools/dart_pkg.py +++ b/build/dart/tools/dart_pkg.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/build/generate_coverage.py b/build/generate_coverage.py index bf675eca09c93..ae7099f47a3fe 100755 --- a/build/generate_coverage.py +++ b/build/generate_coverage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/build/git_revision.py b/build/git_revision.py index 5ee807c3abad5..778d7e70c7d60 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/build/zip.py b/build/zip.py index b257a7ad3c53c..0bcbc02fc9006 100755 --- a/build/zip.py +++ b/build/zip.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/ci/firebase_testlab.py b/ci/firebase_testlab.py index 7aef50c37918b..effd543819ecd 100755 --- a/ci/firebase_testlab.py +++ b/ci/firebase_testlab.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/shell/platform/fuchsia/flutter/build/asset_package.py b/shell/platform/fuchsia/flutter/build/asset_package.py index 90c98fdd2f085..5ec916f5ff027 100755 --- a/shell/platform/fuchsia/flutter/build/asset_package.py +++ b/shell/platform/fuchsia/flutter/build/asset_package.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/shell/platform/fuchsia/flutter/build/gen_debug_wrapper_main.py b/shell/platform/fuchsia/flutter/build/gen_debug_wrapper_main.py index c16a6feca7497..d5811d5cddb05 100755 --- a/shell/platform/fuchsia/flutter/build/gen_debug_wrapper_main.py +++ b/shell/platform/fuchsia/flutter/build/gen_debug_wrapper_main.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/create_ios_framework.py b/sky/tools/create_ios_framework.py index 6ceaa658f3aa0..67092cac3b6e9 100755 --- a/sky/tools/create_ios_framework.py +++ b/sky/tools/create_ios_framework.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/create_macos_gen_snapshots.py b/sky/tools/create_macos_gen_snapshots.py index af833076fec81..301f91cf28a8e 100755 --- a/sky/tools/create_macos_gen_snapshots.py +++ b/sky/tools/create_macos_gen_snapshots.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/create_xcframework.py b/sky/tools/create_xcframework.py index 0bdc952e61798..9bd0609457dbe 100755 --- a/sky/tools/create_xcframework.py +++ b/sky/tools/create_xcframework.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/dist_dart_pkg.py b/sky/tools/dist_dart_pkg.py index af8bd1dbb201d..2a01a571e3ae2 100755 --- a/sky/tools/dist_dart_pkg.py +++ b/sky/tools/dist_dart_pkg.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/flutter_gdb b/sky/tools/flutter_gdb index 0d2fa2adb8601..273952f415f78 100755 --- a/sky/tools/flutter_gdb +++ b/sky/tools/flutter_gdb @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/install_framework_headers.py b/sky/tools/install_framework_headers.py index a746ff90b0e7e..1defe100b1ea9 100755 --- a/sky/tools/install_framework_headers.py +++ b/sky/tools/install_framework_headers.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/objcopy.py b/sky/tools/objcopy.py index b8da36d43b8e3..ed2256bc5f209 100755 --- a/sky/tools/objcopy.py +++ b/sky/tools/objcopy.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/roll/patch.py b/sky/tools/roll/patch.py index f08b610e31601..f7242b4d92489 100755 --- a/sky/tools/roll/patch.py +++ b/sky/tools/roll/patch.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/roll/roll.py b/sky/tools/roll/roll.py index c4d322cb9cebb..b526c6b7c7318 100755 --- a/sky/tools/roll/roll.py +++ b/sky/tools/roll/roll.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/sky/tools/roll/utils.py b/sky/tools/roll/utils.py index c14732e34d12d..c5008eec30b33 100755 --- a/sky/tools/roll/utils.py +++ b/sky/tools/roll/utils.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/testing/rules/run_gradle.py b/testing/rules/run_gradle.py index 41bb007ea6cc9..cdde9a818e3a4 100644 --- a/testing/rules/run_gradle.py +++ b/testing/rules/run_gradle.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/testing/run_tests.py b/testing/run_tests.py index 50eea3b983f7a..5881e161b1d2d 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/android_illegal_imports.py b/tools/android_illegal_imports.py index e07573f141f92..6c292bea12401 100644 --- a/tools/android_illegal_imports.py +++ b/tools/android_illegal_imports.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/androidx/generate_pom_file.py b/tools/androidx/generate_pom_file.py index b2cd3deac37de..10fe63338c739 100644 --- a/tools/androidx/generate_pom_file.py +++ b/tools/androidx/generate_pom_file.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2019 The Flutter 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/dia_dll.py b/tools/dia_dll.py index 9366349878a9b..010ed4f1eeb2c 100644 --- a/tools/dia_dll.py +++ b/tools/dia_dll.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright (c) 2012 The Chromium 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/font-subset/test.py b/tools/font-subset/test.py index d97aa4f9f08c4..977dec352be44 100755 --- a/tools/font-subset/test.py +++ b/tools/font-subset/test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/build_fuchsia_artifacts.py b/tools/fuchsia/build_fuchsia_artifacts.py index a954230bc4c27..861b6eef819d0 100755 --- a/tools/fuchsia/build_fuchsia_artifacts.py +++ b/tools/fuchsia/build_fuchsia_artifacts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/compile_cml.py b/tools/fuchsia/compile_cml.py index 36acd818a43a8..ae058d2f53946 100755 --- a/tools/fuchsia/compile_cml.py +++ b/tools/fuchsia/compile_cml.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/copy_debug_symbols.py b/tools/fuchsia/copy_debug_symbols.py index 4d4cdaef686ca..cc415eb59d420 100755 --- a/tools/fuchsia/copy_debug_symbols.py +++ b/tools/fuchsia/copy_debug_symbols.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/copy_path.py b/tools/fuchsia/copy_path.py index 1dd4693237754..335c262ce3dee 100755 --- a/tools/fuchsia/copy_path.py +++ b/tools/fuchsia/copy_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/gather_flutter_runner_artifacts.py b/tools/fuchsia/gather_flutter_runner_artifacts.py index b337deeaddfd2..e2d67ab8becf6 100755 --- a/tools/fuchsia/gather_flutter_runner_artifacts.py +++ b/tools/fuchsia/gather_flutter_runner_artifacts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index 873356f7c67fd..c9bd85b74aadb 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/gen_repo.py b/tools/fuchsia/gen_repo.py index 84a72603ce225..604fe33cb2367 100755 --- a/tools/fuchsia/gen_repo.py +++ b/tools/fuchsia/gen_repo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/interpolate_test_suite.py b/tools/fuchsia/interpolate_test_suite.py index 0e484ded024b5..3e61f6520fb38 100755 --- a/tools/fuchsia/interpolate_test_suite.py +++ b/tools/fuchsia/interpolate_test_suite.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/make_build_info.py b/tools/fuchsia/make_build_info.py index 4e79f8512bedd..d4565702a199c 100644 --- a/tools/fuchsia/make_build_info.py +++ b/tools/fuchsia/make_build_info.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/merge_and_upload_debug_symbols.py b/tools/fuchsia/merge_and_upload_debug_symbols.py index 6b5786d2079b2..964358671e25f 100755 --- a/tools/fuchsia/merge_and_upload_debug_symbols.py +++ b/tools/fuchsia/merge_and_upload_debug_symbols.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/fuchsia/parse_manifest.py b/tools/fuchsia/parse_manifest.py index bb7e4917e38eb..3863e6bae3199 100755 --- a/tools/fuchsia/parse_manifest.py +++ b/tools/fuchsia/parse_manifest.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tools/gen_android_buildconfig.py b/tools/gen_android_buildconfig.py index f54c8723e914c..485d8f99987af 100644 --- a/tools/gen_android_buildconfig.py +++ b/tools/gen_android_buildconfig.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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_javadoc.py b/tools/gen_javadoc.py index f19d2dda40094..b91096f79e3e4 100755 --- a/tools/gen_javadoc.py +++ b/tools/gen_javadoc.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# # Copyright 2013 The Flutter 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/licenses/lib/main.dart b/tools/licenses/lib/main.dart index 2122f20b9e56c..3adbbf6a36163 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -77,7 +77,7 @@ class _RepositorySourceFile extends _RepositoryLicensedFile { fs.TextFile get ioTextFile => super.io as fs.TextFile; - static final RegExp _hashBangPattern = RegExp(r'^#! *(?:/bin/sh|/bin/bash|/usr/bin/env +(?:python|bash))\b'); + static final RegExp _hashBangPattern = RegExp(r'^#! *(?:/bin/sh|/bin/bash|/usr/bin/env +(?:python|python3|bash))\b'); @override bool get isShellScript {