Convert all build scripts that fail on py3 in CrOS chroot to py2.
These are all the build-time scripts that fail during a build of chrome
in the CrOS chroot when switching the default action() to python3.
Bug: 1112471
Tbr: [email protected]
Change-Id: Ie8bf6a0ad0dbf29f75ada7f41f864177f5ef543a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2783231
Reviewed-by: Dirk Pranke <[email protected]>
Reviewed-by: Ben Pastene <[email protected]>
Commit-Queue: Ben Pastene <[email protected]>
Cr-Commit-Position: refs/heads/master@{#866878}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index c951cb3..b6ba304 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -11,6 +11,7 @@
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/linux/gtk/gtk.gni")
+import("//build/config/python.gni")
import("//build/config/ui.gni")
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
@@ -6659,7 +6660,8 @@
}
}
-action("expired_flags_list_gen") {
+# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
+python2_action("expired_flags_list_gen") {
script = "//tools/flags/generate_expired_list.py"
sources = [ "flag-metadata.json" ]
inputs = [ "//chrome/VERSION" ]
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn b/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn
index f1d5f1f..0a315d5 100644
--- a/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn
+++ b/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn
@@ -243,7 +243,8 @@
}
}
-action("chromevox_phonetic_dictionaries_js") {
+# TODO(crbug.com/1112471): Get this to run under Python3.
+python2_action("chromevox_phonetic_dictionaries_js") {
script = "tools/phonetic_dictionaries.py"
src_dir = [ "$root_out_dir/resources/chromeos/accessibility/_locales" ]
output_file = "$chromevox_out_dir/phonetic_dictionaries.js"
diff --git a/third_party/google_input_tools/closure.gni b/third_party/google_input_tools/closure.gni
index 815c6d7..950a534f 100644
--- a/third_party/google_input_tools/closure.gni
+++ b/third_party/google_input_tools/closure.gni
@@ -2,10 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/python.gni")
+
template("build_closure") {
assert(defined(invoker.sources))
assert(defined(invoker.target))
- action(target_name) {
+
+ # TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
+ python2_action(target_name) {
script = "//third_party/google_input_tools/builder.py"
sources = invoker.sources
outputs = [ invoker.target ]
diff --git a/tools/json_schema_compiler/json_schema_api.gni b/tools/json_schema_compiler/json_schema_api.gni
index 4bc2138b..16bed8b4 100644
--- a/tools/json_schema_compiler/json_schema_api.gni
+++ b/tools/json_schema_compiler/json_schema_api.gni
@@ -111,7 +111,9 @@
root_target_name = target_name
bundle_generator_schema_name = target_name + "_bundle_generator_schema"
- action(bundle_generator_schema_name) {
+
+ # TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
+ python2_action(bundle_generator_schema_name) {
visibility = [ ":$root_target_name" ]
script = compiler_script
inputs = compiler_sources + invoker.sources
@@ -227,7 +229,9 @@
bundle_generator_registration_name =
target_name + "_bundle_generator_registration"
- action(bundle_generator_registration_name) {
+
+ # TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
+ python2_action(bundle_generator_registration_name) {
visibility = [ ":$root_target_name" ]
script = compiler_script
inputs = compiler_sources + invoker.sources
diff --git a/tools/json_to_struct/json_to_struct.gni b/tools/json_to_struct/json_to_struct.gni
index 29afcb2..8bf2e30 100644
--- a/tools/json_to_struct/json_to_struct.gni
+++ b/tools/json_to_struct/json_to_struct.gni
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/python.gni")
+
# Converts a .json file to a C++ struct.
#
# Variables:
@@ -25,7 +27,8 @@
action_name = target_name + "_action"
source_set_name = target_name
- action(action_name) {
+ # TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
+ python2_action(action_name) {
visibility = [ ":$source_set_name" ]
script = "//tools/json_to_struct/json_to_struct.py"