0

Change actions to python2_actions as needed.

As a prelude to starting to move the build fully over to
Python 3, this CL changes all of the GN `action` and
`action_foreach` targets that appear to require Python 2
over to `python2_action` and `python2_action_foreach`.

This CL by itself should produce no functional change since
we'll still be using Python 2 by default, and the new templates
are passthroughs in that config.

To start using Python3, you can run
`gn gen --script-executable=python3 //out/Default` on Unix; on
Python3 you need to point to an actual python3.exe and not
the python3.bat wrapper in depot_tools; once we can roll GN forward
to a version that contains
https://gn-review.googlesource.com/c/gn/+/10560 (which will hopefully
happen in the next day or two), that won't be necessary.

The Fuchsia build will not work until http://fxrev.dev/446479 lands
and is rolled in.

No-Presubmit: true
Bug: 1112471
AX-Relnotes: n/a
Change-Id: I891155502e0940a8075cf26d675f54b803d91242
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510878
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#824216}
This commit is contained in:
Dirk Pranke
2020-11-04 23:56:53 +00:00
committed by Commit Bot
parent aca88ae554
commit ca35ab2022
74 changed files with 453 additions and 128 deletions
ash
build
chrome
BUILD.gn
android
app
browser
BUILD.gn
chromeos
resources
chromeos
accessibility
optimize_webui.gni
installer
mini_installer
test
base
data
media
engagement
preload
updater
mac
win
installer
chromeos/ime
components
autofill_assistant
browser
devtools
metrics
structured
policy
resources
BUILD.gn
ssl
ssl_error_assistant
safe_browsing
core
resources
schema_org
strings
variations
viz
service
compositor_frame_fuzzer
zucchini
fuzzers
content
browser
tracing
public
android
gpu/config
headless
mojo/public
interfaces
bindings
js
tools
ppapi/native_client
nacl_test_data.gni
src
untrusted
pnacl_support_extension
remoting
host
ios
app
resources
resources
tools
sandbox/policy/mac
services/metrics/public/cpp
third_party
blink
renderer
bindings
build
core
closure_compiler
dom_distiller_js
opus
protobuf
quic_trace
wayland
tools
ui/ozone

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/features.gni")
import("//build/config/python.gni")
import("//build/config/ui.gni")
import("//chromeos/assistant/ambient.gni")
import("//mojo/public/tools/bindings/mojom.gni")
@ -1888,7 +1889,8 @@ component("ash") {
}
}
action("dbus_service_files") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("dbus_service_files") {
sources = [
"dbus/org.chromium.DisplayService.conf",
"dbus/org.chromium.GesturePropertiesService.conf",

@ -23,6 +23,9 @@ import("//build/config/python.gni")
template("copy_ex") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"data",

@ -180,6 +180,9 @@ template("write_build_config") {
}
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"deps",
@ -633,6 +636,9 @@ template("generate_android_wrapper") {
template("generate_r_java") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"deps",
@ -986,6 +992,9 @@ template("test_runner_script") {
if (enable_java_templates) {
template("android_lint") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker, [ "testonly" ])
if (!defined(deps)) {
deps = []
@ -1291,6 +1300,9 @@ if (enable_java_templates) {
_expectations_target =
"${invoker.top_target_name}_validate_proguard_config"
action_with_pydeps(_expectations_target) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = _script
# Need to depend on all deps so that proguard.txt within .aar files get
@ -1334,6 +1346,9 @@ if (enable_java_templates) {
_deps += [ ":$_expectations_target" ]
}
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = _script
deps = _deps
inputs = _inputs
@ -1363,6 +1378,9 @@ if (enable_java_templates) {
#
template("java_binary_script") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"deps",
@ -1569,6 +1587,9 @@ if (enable_java_templates) {
_main_dex_list_path = invoker.output + ".main_dex_list"
_main_dex_list_target_name = "${target_name}__main_dex_list"
action_with_pydeps(_main_dex_list_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker, [ "testonly" ])
script = "//build/android/gyp/main_dex_list.py"
@ -1643,6 +1664,9 @@ if (enable_java_templates) {
}
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"data",
@ -2220,6 +2244,9 @@ if (enable_java_templates) {
#
template("prepare_resources") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"deps",
@ -2711,6 +2738,9 @@ if (enable_java_templates) {
_expectations_target =
"${invoker.top_target_name}_validate_android_manifest"
action_with_pydeps(_expectations_target) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
_actual_file = "${invoker.android_manifest}.normalized"
_failure_file =
"$_expectations_failure_dir/" +
@ -2753,6 +2783,9 @@ if (enable_java_templates) {
}
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = _script
depfile = "$target_gen_dir/${target_name}.d"
inputs = _inputs
@ -2775,6 +2808,9 @@ if (enable_java_templates) {
#
template("create_size_info_files") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"testonly",
@ -2996,6 +3032,8 @@ if (enable_java_templates) {
_expectations_target =
"${invoker.top_target_name}_validate_libs_and_assets"
action_with_pydeps(_expectations_target) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
_actual_file = "$target_gen_dir/$target_name.libs_and_assets"
_failure_file =
"$_expectations_failure_dir/" +
@ -3033,6 +3071,8 @@ if (enable_java_templates) {
_deps += [ ":$_expectations_target" ]
}
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
depfile = "$target_gen_dir/$target_name.d"
inputs = _inputs
deps = _deps
@ -3139,6 +3179,9 @@ if (enable_java_templates) {
}
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
if (invoker.use_turbine) {
script = "//build/android/gyp/turbine.py"
} else {
@ -4267,6 +4310,8 @@ template("create_android_app_bundle_module") {
if (defined(invoker.expected_libs_and_assets)) {
_expectations_target = "${invoker.top_target_name}_validate_libs_and_assets"
action_with_pydeps(_expectations_target) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
_actual_file = "$target_gen_dir/$target_name.libs_and_assets"
_failure_file = "$_expectations_failure_dir/" +
string_replace(invoker.expected_libs_and_assets, "/", "_")
@ -4312,6 +4357,8 @@ template("create_android_app_bundle_module") {
}
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
deps = _deps
inputs = _inputs
outputs = _outputs

@ -16,6 +16,9 @@ import("//build/config/python.gni")
#
template("generate_linker_version_script") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "//build/android/gyp/generate_linker_version_script.py"
outputs = [ invoker.linker_script ]
inputs = []

@ -659,6 +659,9 @@ if (enable_java_templates) {
# }
template("jinja_template") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"visibility",
@ -862,6 +865,9 @@ if (enable_java_templates) {
_generating_target_name = "${target_name}__template"
action_with_pydeps(_generating_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
forward_variables_from(invoker,
[
"deps",
@ -3302,6 +3308,9 @@ if (enable_java_templates) {
}
_apk_operations_target_name = "${target_name}__apk_operations"
action_with_pydeps(_apk_operations_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
_generated_script = "$root_build_dir/bin/${invoker.target_name}"
script = "//build/android/gyp/create_apk_operations_script.py"
outputs = [ _generated_script ]
@ -4222,6 +4231,9 @@ if (enable_java_templates) {
assert(_scanned_files.has_classes_jar || _scanned_files.subjars == [])
action_with_pydeps(_unpack_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "//build/android/gyp/aar.py" # Unzips the AAR
args = [
"extract",
@ -4873,6 +4885,9 @@ if (enable_java_templates) {
_bundle_target_name = "${_target_name}__bundle"
action_with_pydeps(_bundle_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "//build/android/gyp/create_app_bundle.py"
inputs = _all_module_zip_paths + _all_module_build_configs
outputs = [ _bundle_path ]
@ -4972,6 +4987,9 @@ if (enable_java_templates) {
_bundle_wrapper_script_path = "$_bundle_wrapper_script_dir/$_target_name"
action_with_pydeps("${_target_name}__wrapper_script") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "//build/android/gyp/create_bundle_wrapper_script.py"
inputs = [ _base_module_build_config ]
outputs = [ _bundle_wrapper_script_path ]

@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/gclient_args.gni")
import("//build/config/python.gni")
assert(is_chromeos)
@ -97,7 +98,8 @@ template("generate_runner_script") {
"Tast tests are invoked from binaries shipped with the VM image. " +
"There should be no locally built binary needed.")
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
if (defined(runtime_deps_file)) {
write_runtime_deps = runtime_deps_file
}

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/nacl/config.gni")
import("//build/config/python.gni")
# Generate a nmf file
#
@ -19,7 +20,8 @@ template("generate_nmf") {
assert(defined(invoker.executables), "Must define executables")
assert(defined(invoker.nmf), "Must define nmf")
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
forward_variables_from(invoker,
[
"deps",

@ -63,6 +63,8 @@ template("python_library") {
}
}
_is_python2 = exec_script("//build/util/is_python2.py", [], "json")
# This is a wrapper around action() that ensures that the script is
# run under a Python2 executable, even if the main script_executable is
# Python3.
@ -86,28 +88,32 @@ template("python2_action") {
forward_variables_from(invoker,
"*",
[
"script",
"inputs",
"args",
"testonly",
"visibility",
])
script = "//build/util/python2_action.py"
if (!defined(invoker.inputs)) {
if (!_is_python2) {
script = "//build/util/python2_action.py"
_rebased_script = rebase_path(invoker.script, root_build_dir)
inputs = []
inputs = [ invoker.script ]
} else {
inputs = [ invoker.script ] + invoker.inputs
if (defined(invoker.inputs)) {
inputs += invoker.inputs
}
args = []
args = [ _rebased_script ]
if (defined(invoker.args)) {
args += invoker.args
}
}
args = [ rebase_path(invoker.script, root_build_dir) ] + invoker.args
}
}
# This is a wrapper around action() that ensures that the script is
# This is a wrapper around action_foreach() that ensures that the script is
# run under a Python2 executable, even if the main script_executable is
# Python3.
#
# It supports all of action()'s arguments.
# It supports all of action_foreach()'s arguments.
#
# TODO(crbug.com/1112471): Remove this once everything runs cleanly under
# Python3.
@ -126,20 +132,24 @@ template("python2_action_foreach") {
forward_variables_from(invoker,
"*",
[
"script",
"inputs",
"args",
"testonly",
"visibility",
])
script = "//build/util/python2_action.py"
if (!defined(invoker.inputs)) {
if (!_is_python2) {
script = "//build/util/python2_action.py"
_rebased_script = rebase_path(invoker.script, root_build_dir)
inputs = []
inputs = [ invoker.script ]
} else {
inputs = [ invoker.script ] + invoker.inputs
if (defined(invoker.inputs)) {
inputs += invoker.inputs
}
args = []
args = [ _rebased_script ]
if (defined(invoker.args)) {
args += invoker.args
}
}
args = [ rebase_path(invoker.script, root_build_dir) ] + invoker.args
}
}
@ -197,7 +207,7 @@ template("action_with_pydeps") {
_script_dir = get_path_info(_pydeps_file, "dir")
inputs += rebase_path(_pydeps_entries, ".", _script_dir)
if (defined(run_under_python2) && run_under_python2) {
if (defined(run_under_python2) && run_under_python2 && !_is_python2) {
inputs += [ invoker.script ]
_args = args
args = []
@ -246,7 +256,7 @@ template("action_foreach_with_pydeps") {
_script_dir = get_path_info(script, "dir")
inputs += rebase_path(_pydeps_entries, ".", _script_dir)
if (defined(run_under_python2) && run_under_python2) {
if (defined(run_under_python2) && run_under_python2 && !_is_python2) {
inputs += [ invoker.script ]
_args = args
args = []

@ -25,6 +25,7 @@ build_dotfile_settings = {
"//build/config/mac/mac_sdk.gni",
"//build/config/mac/rules.gni",
"//build/config/posix/BUILD.gn",
"//build/config/python.gni",
"//build/config/sysroot.gni",
"//build/config/win/BUILD.gn",
"//build/config/win/visual_studio_version.gni",

@ -59,6 +59,7 @@
# least processed when things go right.
import("//build/config/clang/clang.gni")
import("//build/config/python.gni")
import("//build/toolchain/toolchain.gni")
import("//testing/test.gni")
@ -74,7 +75,8 @@ if (enable_nocompile_tests) {
template("nocompile_test") {
nocompile_target = target_name + "_run_nocompile"
action_foreach(nocompile_target) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach(nocompile_target) {
testonly = true
script = "//tools/nocompile_driver.py"
sources = invoker.sources

@ -89,7 +89,7 @@ template("midl") {
proxy_file = "{{source_name_part}}_p.c"
type_library_file = "{{source_name_part}}.tlb"
# TODO(crbug.com/1112471): Get this working directly under Python 3.
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach(action_name) {
visibility = [ ":$source_set_name" ]
script = "//build/toolchain/win/midl.py"

9
build/util/is_python2.py Normal file

@ -0,0 +1,9 @@
# Copyright 2020 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.
"""Script for checking if we're running Python 2 or 3."""
import subprocess
import sys
print("true" if sys.version_info.major == 2 else "false")

@ -7,6 +7,7 @@ import("//build/config/chromeos/ui_mode.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/features.gni")
import("//build/config/locales.gni")
import("//build/config/python.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/config/win/console_app.gni")
@ -59,7 +60,8 @@ if (enable_resource_allowlist_generation) {
}
if (is_win) {
action("reorder_imports") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("reorder_imports") {
script = "//build/win/reorder-imports.py"
# See comment in chrome_dll.gypi in the hardlink_to_output

@ -685,7 +685,8 @@ group("jni_headers") {
]
}
action("chrome_android_java_google_api_keys_srcjar") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("chrome_android_java_google_api_keys_srcjar") {
script = "//build/android/gyp/java_google_api_keys.py"
_output_path = "$target_gen_dir/$target_name.srcjar"
outputs = [ _output_path ]

@ -73,6 +73,9 @@ template("android_library_factory") {
_base_gen_dir = "${target_gen_dir}/${target_name}"
action_foreach_with_pydeps(_process_factory_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "//chrome/android/features/create_stripped_java_factory.py"
sources = invoker.sources
outputs =

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/android/rules.gni")
import("//build/config/python.gni")
template("mustache_pass") {
forward_variables_from(invoker, [ "testonly" ])
@ -10,7 +11,8 @@ template("mustache_pass") {
assert(defined(invoker.input))
assert(defined(invoker.output))
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
forward_variables_from(invoker,
[
"visibility",

@ -64,6 +64,9 @@ if (is_android) {
}
grit("generated_resources") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
source = "generated_resources.grd"
defines = chrome_grit_defines
output_dir = "$root_gen_dir/chrome"

@ -6278,6 +6278,9 @@ proto_library("permissions_proto") {
}
grit("resources") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
source = "browser_resources.grd"
# Required due to flattenhtml = "true" on a generated file.

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/features.gni")
import("//build/config/python.gni")
import("//build/config/ui.gni")
import("//chromeos/components/chromebox_for_meetings/buildflags/buildflags.gni")
import("//extensions/buildflags/buildflags.gni")
@ -3026,7 +3027,8 @@ source_set("chromeos") {
}
}
action("dbus_service_files") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("dbus_service_files") {
sources = [
"dbus/org.chromium.ChromeFeaturesService.conf",
"dbus/org.chromium.ComponentUpdaterService.conf",
@ -4039,7 +4041,8 @@ proto_library("print_job_info_proto") {
device_policy_remover_path = "$target_gen_dir/device_policy_remover.cc"
action("device_policy_remover_generate") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("device_policy_remover_generate") {
script = "policy/tools/generate_device_policy_remover.py"
descriptor_pool_path = "//third_party/protobuf/python"
symbol_database_path = "$root_out_dir/pyproto"

@ -1,6 +1,7 @@
# Copyright 2016 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.
import("//build/config/python.gni")
import("//chromecast/chromecast.gni")
assert(is_chromeos || is_chromecast)
@ -28,7 +29,9 @@ template("run_jsbundler") {
} else {
rewrite_rules = []
}
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "//chrome/browser/resources/chromeos/accessibility/chromevox/tools/jsbundler.py"
inputs = jsbundler_modules
sources = invoker.sources

@ -2,8 +2,11 @@
# 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("node") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
forward_variables_from(invoker, "*")
# Declare dependencies to all involved tools.

@ -4,6 +4,7 @@
import("//build/config/compiler/compiler.gni")
import("//build/config/features.gni")
import("//build/config/python.gni")
import("//build/config/ui.gni")
import("//chrome/process_version_rc_template.gni")
import("//components/nacl/features.gni")
@ -134,7 +135,8 @@ template("generate_mini_installer") {
archive_name = target_name + "_archive"
staging_dir = "$target_gen_dir/$target_name"
action(archive_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(archive_name) {
script = "//chrome/tools/build/win/create_installer_archive.py"
release_file = "chrome.release"

@ -2,6 +2,7 @@
# 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")
import("//v8/gni/snapshot_toolchain.gni")
import("//v8/gni/v8.gni")
@ -53,7 +54,8 @@ template("js2gtest") {
data += invoker.data
}
action_foreach(action_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach(action_name) {
testonly = true
visibility = [ ":$source_set_name" ]
script = "//tools/gypv8sh.py"

@ -3,9 +3,11 @@
# found in the LICENSE file.
import("//build/compiled_action.gni")
import("//build/config/python.gni")
# Generates a proto file based on the real list.
action_foreach("generate_preload_list") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach("generate_preload_list") {
script = "//tools/media_engagement_preload/make_dafsa.py"
sources = [ "test.json" ]

@ -4,6 +4,7 @@
import("//build/apple/tweak_info_plist.gni")
import("//build/config/mac/rules.gni")
import("//build/config/python.gni")
import("//build/util/version.gni")
import("//chrome/updater/branding.gni")
@ -119,7 +120,8 @@ source_set("updater_setup_sources") {
]
}
action("updater_install_script") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("updater_install_script") {
script = "embed_variables.py"
inputs = [
@ -139,7 +141,8 @@ action("updater_install_script") {
]
}
action("browser_install_script") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("browser_install_script") {
script = "embed_variables.py"
inputs = [

@ -2,6 +2,7 @@
# 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")
import("//build/timestamp.gni")
import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni")
@ -52,7 +53,8 @@ template("generate_installer") {
archive_name = target_name + "_archive"
staging_dir = "$target_gen_dir/$target_name"
action(archive_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(archive_name) {
script = "create_installer_archive.py"
release_file = "updater.release"

@ -2,7 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
action("gencode") {
import("//build/config/python.gni")
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("gencode") {
script = "gen_input_methods.py"
sources = [ "//chromeos/ime/input_methods.txt" ]
outputs = [ "$target_gen_dir/input_methods.h" ]

@ -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")
devtools_domains = [
"accessibility",
"animation",
@ -51,7 +53,8 @@ foreach(domain, devtools_domains) {
]
}
action("gen_devtools_client_api") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("gen_devtools_client_api") {
script = "devtools_api/client_api_generator.py"
deps = [ "//third_party/blink/public/devtools_protocol:protocol_version" ]
inputs = [

@ -2,6 +2,7 @@
# 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")
import("//testing/test.gni")
# Structured metrics is subcomponent of UMA that gathers and reports structured
@ -31,7 +32,8 @@ static_library("structured") {
]
}
action("gen_structured_events") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("gen_structured_events") {
script = "//tools/metrics/structured/gen_events.py"
# Re-generate the outputs if the codegen code changes:

@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
import("//build/config/mac/base_rules.gni")
import("//build/config/python.gni")
import("//build/toolchain/toolchain.gni")
import("//components/policy/resources/policy_templates.gni")
import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
@ -97,7 +98,8 @@ constants_source_path = "$target_gen_dir/policy_constants.cc"
app_restrictions_path = "$target_gen_dir/app_restrictions.xml"
risk_tag_header_path = "$target_gen_dir/risk_tag.h"
action("policy_code_generate") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("policy_code_generate") {
script = "tools/generate_policy_source.py"
chrome_version_abspath = "//chrome/VERSION"
chrome_version_path = rebase_path(chrome_version_abspath, root_build_dir)
@ -141,7 +143,8 @@ action("policy_code_generate") {
]
}
action("full_runtime_code_generate") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("full_runtime_code_generate") {
script = "tools/generate_policy_source.py"
chrome_version_abspath = "//chrome/VERSION"
chrome_version_path = rebase_path(chrome_version_abspath, root_build_dir)
@ -187,7 +190,8 @@ grit("translate_policy_templates") {
}
# Generate the various templates and docs (admx, doc, json, etc.)
action("policy_templates") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("policy_templates") {
script = "tools/template_writers/template_formatter.py"
chrome_version_abspath = "//chrome/VERSION"
chrome_version_path = rebase_path(chrome_version_abspath, root_build_dir)

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/android/config.gni")
import("//build/config/python.gni")
import("//components/safe_browsing/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//tools/grit/grit_rule.gni")
@ -85,7 +86,8 @@ grit("components_scaled_resources") {
output_dir = "$root_gen_dir/components"
}
action("about_credits") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("about_credits") {
script = "//tools/licenses.py"
depfile = "$target_gen_dir/$target_name.d"

@ -2,8 +2,11 @@
# 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")
# Generate the binary proto form of "ssl_error_assistant" from the ascii proto.
action("make_ssl_error_assistant_protobuf") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("make_ssl_error_assistant_protobuf") {
script = "gen_ssl_error_assistant_proto.py"
# The output goes in $target_gen_dir since that's where

@ -2,10 +2,13 @@
# 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")
# TODO(nparker): reduce the duplication between these two, somehow.
# Generate the binary proto form of "file_types" from the ascii proto.
action("make_file_types_protobuf") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("make_file_types_protobuf") {
script = "gen_file_type_proto.py"
# The output goes in $target_gen_dir since that's where
@ -63,7 +66,8 @@ action("make_file_types_protobuf") {
# Generate the binary proto for ALL platforms. This is only run manually
# when pushing the files to GCS for the component-updater to pick up.
action("make_all_file_types_protobuf") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("make_all_file_types_protobuf") {
script = "gen_file_type_proto.py"
input_filename = "download_file_types.asciipb"

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/compiled_action.gni")
import("//build/config/python.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
source_set("unit_tests") {
@ -52,7 +53,8 @@ compiled_action("schema_org_name_data") {
outputs = [ "$target_gen_dir/schema_org_name_data.json" ]
}
action("generate_schema_org_code") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("generate_schema_org_code") {
script = "//components/schema_org/generate_schema_org_code.py"
sources = [

@ -57,6 +57,11 @@ if (is_android) {
}
grit("components_chromium_strings") {
# TODO(crbug.com/1112471). For reasons I don't understand,
# IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM is not defined
# on desktop linux when this is run under Python3. Fix this.
run_under_python2 = true
source = "../components_chromium_strings.grd"
outputs = [ "grit/components_chromium_strings.h" ]
foreach(locale, locales_with_fake_bidi) {

@ -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")
# Runs the resources map generation script other the given header files to
# produce an output file and a source_set to build it.
#
@ -30,7 +32,8 @@ template("generate_ui_string_overrider") {
source_set_target_name = target_name
gen_action_target_name = target_name + "_gen_sources"
action(gen_action_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(gen_action_target_name) {
header_filename = "$target_gen_dir/" + invoker.header_filename
source_filename = "$target_gen_dir/" + invoker.source_filename

@ -2,6 +2,7 @@
# 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")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/protobuf/proto_library.gni")
@ -19,7 +20,8 @@ proto_library("compositor_frame_fuzzer_proto") {
# The messages must be of type RenderPass, as defined in the proto2 file
# compositor_frame_fuzzer.proto (these assumptions are all hardcoded into
# generate_renderpass_binary.py)
action_foreach("generate_seed_corpus") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach("generate_seed_corpus") {
script = "generate_renderpass_binary.py"
pyproto_path = "$root_out_dir/pyproto"

@ -2,6 +2,7 @@
# 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")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/protobuf/proto_library.gni")
@ -71,7 +72,8 @@ proto_library("zucchini_file_pair_proto") {
# Disabled on Windows due to crbug/844826.
if (current_toolchain == host_toolchain && !is_win) {
# Raw Apply Fuzzer Seed:
action("zucchini_raw_apply_seed") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("zucchini_raw_apply_seed") {
script = "generate_fuzzer_data.py"
args = [
@ -107,7 +109,8 @@ if (current_toolchain == host_toolchain && !is_win) {
}
# ZTF Apply Fuzzer Seed:
action("zucchini_ztf_apply_seed") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("zucchini_ztf_apply_seed") {
script = "generate_fuzzer_data.py"
# *.ztf files are expected to be valid ZTF format.

@ -2,6 +2,7 @@
# 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")
import("//tools/grit/grit_rule.gni")
# generate_about_tracing puts its files in this directory
@ -11,7 +12,8 @@ tracing_gen_dir = "$root_gen_dir/content/browser/tracing"
# this file to be in the same directory as the inputs.
tracing_grd = "$tracing_gen_dir/tracing_resources.grd"
action("generate_tracing_grd") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("generate_tracing_grd") {
visibility = [ ":*" ] # Depend on ":resources" to get this.
script = "generate_trace_viewer_grd.py"

@ -57,6 +57,9 @@ android_resources("content_java_resources") {
}
action_with_pydeps("generate_sandboxed_service_srcjar") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "//content/public/android/generate_child_service.py"
_srcjar_path = "${target_gen_dir}/${target_name}.srcjar"

@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/python.gni")
import("//build/config/ui.gni")
import("//gpu/vulkan/features.gni")
@ -31,7 +32,8 @@ process_json_outputs = [
"$target_gen_dir/software_rendering_list_exceptions_autogen.h",
]
action("process_json") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("process_json") {
script = "process_json.py"
inputs = [

@ -4,6 +4,7 @@
import("//build/config/c++/c++.gni")
import("//build/config/chrome_build.gni")
import("//build/config/python.gni")
import("//build/util/lastchange.gni")
import("//build/util/process_version.gni")
import("//headless/headless.gni")
@ -77,7 +78,8 @@ repack("pak") {
output = "$root_out_dir/headless_lib.pak"
}
action("embed_resources") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("embed_resources") {
# TODO(altimin): Consider zipping file here, it can reduce size up to 80%.
script = "lib/embed_data.py"

@ -2,6 +2,7 @@
# 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")
import("../../../tools/bindings/mojom.gni")
group("test_data_deps") {
@ -254,7 +255,8 @@ copy("validation_test_data") {
outputs = [ "$root_gen_dir/layout_test_data/{{source_root_relative_dir}}/{{source_file_part}}" ]
}
action_foreach("validation_test_data_list") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach("validation_test_data_list") {
testonly = true
script = "//mojo/public/tools/bindings/gen_data_files_list.py"
inputs = mojom_generator_sources

@ -2,6 +2,7 @@
# 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")
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/closure_compiler/closure_args.gni")
import("//third_party/closure_compiler/compile_js.gni")
@ -9,7 +10,8 @@ import("//tools/grit/grit_rule.gni")
interfaces_bindings_gen_dir = "$root_gen_dir/mojo/public/interfaces/bindings"
action("bindings") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("bindings") {
bindings_js_files = [
# This must be the first file in the list, because it initializes global
# variable |mojo| that the others need to refer to.
@ -50,7 +52,8 @@ action("bindings") {
}
template("concatenate_files") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "//mojo/public/tools/bindings/concatenate-files.py"
inputs = invoker.inputs
output = "$target_gen_dir/${invoker.output}"
@ -175,6 +178,8 @@ js_library("bindings_uncompiled") {
}
grit("resources") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
source = "mojo_bindings_resources.grd"
outputs = [

@ -2,10 +2,12 @@
# 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")
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/jinja2/jinja2.gni")
action("precompile_templates") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("precompile_templates") {
sources = mojom_generator_sources
sources += [
"$mojom_generator_root/generators/cpp_templates/enum_macros.tmpl",

@ -2,6 +2,7 @@
# 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")
import("//third_party/closure_compiler/closure_args.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//third_party/protobuf/proto_library.gni")
@ -629,7 +630,8 @@ template("mojom") {
enabled_features += [ "is_win" ]
}
action(parser_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(parser_target_name) {
script = mojom_parser_script
inputs = mojom_parser_sources + [ build_metadata_filename ]
sources = sources_list
@ -651,7 +653,7 @@ template("mojom") {
# Resolve relative input mojom paths against both the root src dir and
# the root gen dir.
"--input-root",
rebase_path("//"),
rebase_path("//."),
"--input-root",
rebase_path(root_gen_dir),
@ -746,7 +748,8 @@ template("mojom") {
}
}
action(generator_cpp_message_ids_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(generator_cpp_message_ids_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources + jinja2_sources
sources = sources_list
@ -785,7 +788,9 @@ template("mojom") {
}
generator_shared_target_name = "${target_name}_shared__generator"
action(generator_shared_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(generator_shared_target_name) {
visibility = [ ":*" ]
script = mojom_generator_script
inputs = mojom_generator_sources + jinja2_sources
@ -904,7 +909,9 @@ template("mojom") {
generator_mojolpm_proto_target_name =
"${target_name}_mojolpm_proto_generator"
action(generator_mojolpm_proto_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(generator_mojolpm_proto_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources + jinja2_sources
sources = invoker.sources
@ -1093,7 +1100,9 @@ template("mojom") {
]
generator_target_name = "${target_name}${variant_suffix}__generator"
action(generator_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(generator_target_name) {
visibility = [ ":*" ]
script = mojom_generator_script
inputs = mojom_generator_sources + jinja2_sources
@ -1273,7 +1282,9 @@ template("mojom") {
}
write_file(_typemap_config_filename, _rebased_typemap_configs, "json")
_mojom_target_name = target_name
action(_typemap_validator_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(_typemap_validator_target_name) {
script = "$mojom_generator_root/validate_typemap_config.py"
inputs = [ _typemap_config_filename ]
outputs = [ _typemap_stamp_filename ]
@ -1284,7 +1295,8 @@ template("mojom") {
]
}
action(type_mappings_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(type_mappings_target_name) {
inputs =
mojom_generator_sources + jinja2_sources + [ _typemap_stamp_filename ]
outputs = [ type_mappings_path ]
@ -1453,7 +1465,8 @@ template("mojom") {
java_generator_target_name = target_name + "_java__generator"
if (sources_list != []) {
action(java_generator_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(java_generator_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources + jinja2_sources
sources = sources_list
@ -1492,7 +1505,9 @@ template("mojom") {
}
java_srcjar_target_name = target_name + "_java_sources"
action(java_srcjar_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(java_srcjar_target_name) {
script = "//build/android/gyp/zip.py"
inputs = []
if (output_file_base_paths != []) {
@ -1551,7 +1566,9 @@ template("mojom") {
!use_typescript_for_target) {
if (sources_list != []) {
generator_js_target_name = "${target_name}_js__generator"
action(generator_js_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(generator_js_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources + jinja2_sources
sources = sources_list
@ -1791,7 +1808,9 @@ template("mojom") {
# Generate Typescript bindings.
generator_ts_target_name =
"${target_name}_${dependency_type.name}__ts__generator"
action(generator_ts_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(generator_ts_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources + jinja2_sources
sources = sources_list
@ -1858,7 +1877,8 @@ template("mojom") {
"${target_name}_${dependency_type.name}__js__generator"
generator_js_target_names += [ generator_js_target_name ]
action(generator_js_target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(generator_js_target_name) {
script = "$mojom_generator_root/compile_typescript.py"
sources = ts_outputs
outputs = js_outputs

@ -4,6 +4,7 @@
import("//build/config/nacl/config.gni")
import("//build/config/nacl/rules.gni")
import("//build/config/python.gni")
import("//components/nacl/features.gni")
assert(enable_nacl)
@ -182,7 +183,8 @@ template("nacl_test_data") {
# This is a template so it can be invoked twice in the
# defined(extra_tc_cpu) case below.
template("nacl_test_data_pretranslate_pexe") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
translate_cpu = invoker.translate_cpu
visibility = [ ":$nexe_copy_target_name" ]

@ -2,6 +2,7 @@
# 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")
import("//components/nacl/features.gni")
assert(enable_nacl)
@ -10,7 +11,8 @@ assert(enable_nacl)
# toolchain and copies the latest PNaCl IRT shim library.
# We could use 'copies', but we want to rename the files in a white-listed
# way first. Thus use an action.
action("pnacl_support_extension") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("pnacl_support_extension") {
script = "pnacl_component_crx_gen.py"
inputs = [
"//native_client/build/package_version/package_version.py",

@ -2,6 +2,7 @@
# 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")
import("//build/util/process_version.gni")
import("//remoting/build/config/remoting_build.gni")
@ -644,7 +645,8 @@ if (enable_remoting_host) {
}
}
action_foreach("remoting_native_messaging_manifests") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach("remoting_native_messaging_manifests") {
if (is_mac) {
me2me_host_path = "/Library/PrivilegedHelperTools/$me2me_host_bundle_name/Contents/MacOS/$native_messaging_host_bundle_name/Contents/MacOS/native_messaging_host"
it2me_host_path = "/Library/PrivilegedHelperTools/$me2me_host_bundle_name/Contents/MacOS/$remote_assistance_host_bundle_name/Contents/MacOS/remote_assistance_host"
@ -686,7 +688,8 @@ if (enable_remoting_host) {
]
}
action_foreach("remoting_infoplist_strings") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach("remoting_infoplist_strings") {
sources = [
"it2me/remote_assistance_host-InfoPlist.strings.jinja2",
"remoting_me2me_host-InfoPlist.strings.jinja2",

@ -2,9 +2,11 @@
# 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")
import("//remoting/build/config/remoting_build.gni")
action("credits") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("credits") {
# We put this in $root_build_dir/gen/remoting instead of
# $root_build_dir/gen/remoting/host (target_gen_dir) for
# compatibility w/ GYP, since the installer needs the file to

@ -2,11 +2,13 @@
# 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")
import("//build/config/zip.gni")
import("//chrome/installer/mac/mac_signing_sources.gni")
import("//remoting/build/config/remoting_build.gni")
action("remoting_me2me_host_archive") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("remoting_me2me_host_archive") {
_installer_mac_files = [
"do_signing.sh",
"do_signing.props",

@ -2,10 +2,12 @@
# 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")
import("//remoting/build/config/remoting_build.gni")
import("//remoting/host/installer/win/generate_clsids.gni")
action("remoting_me2me_host_archive") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("remoting_me2me_host_archive") {
script = "//remoting/host/installer/build-installer-archive.py"
sources = [ "//build/android/gyp/util/build_utils.py" ]

@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/ios/asset_catalog.gni")
import("//build/config/ios/rules.gni")
import("//build/config/python.gni")
import("//remoting/build/config/remoting_build.gni")
import("//remoting/remoting_locales.gni")
@ -87,7 +88,8 @@ appiconset("remoting_icons") {
# i18n
action("infoplist_strings") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("infoplist_strings") {
_source = "InfoPlist.strings.jinja2"
sources = [ _source ]

@ -2,6 +2,7 @@
# 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")
import("//remoting/remoting_locales.gni")
import("//tools/grit/grit_rule.gni")
@ -13,7 +14,8 @@ group("resources") {
]
}
action("verify_resources") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("verify_resources") {
script = "//remoting/tools/verify_resources.py"
sources_to_verify = [
@ -82,7 +84,8 @@ if (is_android) {
}
}
action("copy_locales") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("copy_locales") {
script = "../tools/build/remoting_copy_locales.py"
# The gyp build calls out to Python, but the Python just computes a simple

@ -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")
# Calls the remoting_localize script with a jinja2 template.
#
# Arguments
@ -33,7 +35,8 @@
# deps (optional)
# visibility (optional)
template("remoting_localize") {
action_foreach(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach(target_name) {
if (defined(invoker.visibility)) {
visibility = invoker.visibility
}

@ -2,7 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
action_foreach("package_sb_files") {
import("//build/config/python.gni")
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach("package_sb_files") {
script = "package_sb_file.py"
sources = [
"audio.sb",

@ -2,6 +2,7 @@
# 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")
import("//mojo/public/tools/bindings/mojom.gni")
component("metrics_cpp") {
@ -56,7 +57,8 @@ source_set("tests") {
]
}
action("gen_ukm_builders") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("gen_ukm_builders") {
script = "//tools/metrics/ukm/gen_builders.py"
# Re-generate the outputs if the codegen code changes:
@ -64,7 +66,6 @@ action("gen_ukm_builders") {
"//tools/metrics/ukm/builders_template.py",
"//tools/metrics/ukm/decode_template.py",
"//tools/metrics/ukm/codegen.py",
"//tools/metrics/ukm/gen_builders.py",
]
sources = [ "//tools/metrics/ukm/ukm.xml" ]

@ -17,7 +17,8 @@ import("//third_party/blink/renderer/modules/modules_idl_files.gni")
visibility = [ "//third_party/blink/renderer/*" ]
action("interfaces_info") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("interfaces_info") {
script = "$bindings_scripts_dir/compute_interfaces_info_overall.py"
inputs = [
@ -65,6 +66,9 @@ if (use_blink_v8_binding_new_idl_interface) {
template("collect_idl_files") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "${bindings_scripts_dir}/collect_idl_files.py"
inputs = invoker.inputs
@ -139,6 +143,9 @@ collect_idl_files("web_idl_in_modules_for_testing") {
}
action_with_pydeps("web_idl_database") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "${bindings_scripts_dir}/build_web_idl_database.py"
input_data_files = get_target_outputs(":web_idl_in_core") +
@ -168,6 +175,9 @@ action_with_pydeps("web_idl_database") {
template("generate_bindings") {
action_with_pydeps(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "${bindings_scripts_dir}/generate_bindings.py"
if (defined(invoker.pool)) {
@ -232,6 +242,9 @@ generate_bindings("generate_bindings_all") {
}
action_with_pydeps("generate_high_entropy_list") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
script = "${bindings_scripts_dir}/generate_high_entropy_list.py"
web_idl_database_outputs = get_target_outputs(":web_idl_database")

@ -2,6 +2,7 @@
# 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")
import("//third_party/blink/renderer/bindings/bindings.gni")
import("//third_party/blink/renderer/bindings/generated_in_modules.gni")
import("//third_party/blink/renderer/bindings/modules/v8/generated.gni")
@ -247,7 +248,8 @@ blink_modules_sources("bindings_modules_impl") {
]
}
action("generate_v8_context_snapshot_external_references") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("generate_v8_context_snapshot_external_references") {
script = "$bindings_scripts_dir/generate_v8_context_snapshot_external_references.py"
idl_files =
core_interface_idl_files_core_only +

@ -2,6 +2,7 @@
# 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")
import("//third_party/blink/renderer/build/scripts/scripts.gni")
import("//third_party/blink/renderer/core/core_idl_files.gni")
import("//third_party/blink/renderer/modules/modules_idl_files.gni")
@ -65,7 +66,8 @@ idl_compiler_files = get_path_info(
# component_info_file = output pickle file for component wide info.
# deps = dependencies
template("compute_interfaces_info") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "$bindings_scripts_dir/compute_interfaces_info_individual.py"
if (defined(invoker.visibility)) {
visibility = invoker.visibility
@ -112,7 +114,8 @@ template("compute_interfaces_info") {
# output_file = The .in file to write, relative to the blink_gen_dir.
# suffix = (Optional) String to be passed to script via --suffix
template("generate_event_interfaces") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
# Write the file list to a unique temp file to avoid blowing out the
# command line length limit.
idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp"
@ -196,7 +199,8 @@ template("idl_compiler") {
# Spawning a python process per IDL file is slow. Use a single action
# instead (crbug.com/821256).
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = _script
inputs = _inputs
public_deps = _public_deps
@ -245,7 +249,8 @@ template("idl_compiler") {
template("idl_impl") {
dictionary_impl_output_dir = "$root_gen_dir/third_party/blink/renderer/"
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "//third_party/blink/renderer/bindings/scripts/idl_compiler.py"
idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp"
write_file(idl_files_list, rebase_path(invoker.dict_idls, root_build_dir))
@ -439,7 +444,8 @@ template("generate_global_constructors") {
# deps = dependencies
#
template("generate_origin_trial_features") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "//third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py"
# Write the file list to a unique temp file to avoid blowing out the

@ -2,6 +2,7 @@
# 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")
import("//build/toolchain/toolchain.gni")
import("//third_party/blink/renderer/config.gni")
@ -91,7 +92,8 @@ make_core_generated_deps = [
# - //third_party/blink/renderer/build/scripts
# - //third_party
template("blink_python_runner") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "$_scripts_dir/run_with_pythonpath.py"
sources = [ invoker.script ]
if (defined(invoker.sources)) {

@ -921,16 +921,22 @@ blink_python_runner("make_core_generated_css_tokenizer_codepoints") {
blink_python_runner("make_core_generated_css_primitive_value_unit_trie") {
visibility = [] # Allow re-assignment of list.
visibility = [ ":*" ]
script = "../build/scripts/core/css/make_css_primitive_value_unit_trie.py"
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
script = "//build/util/python2_action.py"
input_file = "css/css_primitive_value_units.json5"
inputs = make_trie_helpers_files + [
input_file,
"../build/scripts/core/css/make_css_primitive_value_unit_trie.py",
"../build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl",
]
outputs = [ "$blink_core_output_dir/css/css_primitive_value_unit_trie.cc" ]
args = [
rebase_path(
"../build/scripts/core/css/make_css_primitive_value_unit_trie.py",
root_build_dir),
rebase_path(input_file, root_build_dir),
"--output_dir",
"$rel_blink_core_gen_dir/css",
@ -1003,6 +1009,7 @@ blink_python_runner("make_core_generated_origin_trials") {
"$rel_blink_core_gen_dir/origin_trials",
]
}
blink_python_runner("make_core_generated_web_origin_trials") {
script = "../build/scripts/make_web_origin_trials.py"

@ -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")
import("//third_party/closure_compiler/closure_args.gni")
declare_args() {
@ -53,7 +55,8 @@ polymer_externs = "$externs_path/polymer-1.0.js"
# }
template("js_library") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "$script_path/js_library.py"
forward_variables_from(invoker,
[
@ -153,7 +156,8 @@ template("js_library") {
# }
template("js_binary") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "$script_path/js_binary.py"
forward_variables_from(invoker,
[

@ -2,6 +2,7 @@
# 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")
import("//third_party/protobuf/proto_library.gni")
group("proto") {
@ -50,7 +51,8 @@ proto_library("json_values_converter_test_proto") {
generator_plugin_options = "output_dir=:"
}
action("json_values_converter_tests") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("json_values_converter_tests") {
_stamp = "$target_gen_dir/json_values_converter_tests.stamp"
deps = [ ":json_values_converter_test_proto" ]
inputs = [ "test_sample_json_converter.h.golden" ]

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/arm.gni")
import("//build/config/python.gni")
import("//testing/test.gni")
# If fixed point implementation shall be used (otherwise float).
@ -21,7 +22,8 @@ use_opus_x86_optimization =
# If OPUS Run Time CPU Detections (RTCD) shall be used.
# Based on the conditions in celt/arm/armcpu.c:
# defined(_MSC_VER) || defined(__linux__).
use_opus_arm_rtcd = current_cpu == "arm" && (is_win || is_android || is_linux || is_chromeos)
use_opus_arm_rtcd =
current_cpu == "arm" && (is_win || is_android || is_linux || is_chromeos)
config("opus_config") {
include_dirs = [ "src/include" ]
@ -168,7 +170,8 @@ config("opus_test_no_nonnull_config") {
}
if (use_opus_arm_rtcd) {
action("convert_rtcd_assembler") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("convert_rtcd_assembler") {
script = "convert_rtcd_assembler.py"
outputs = [ "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S" ]
args = [
@ -372,8 +375,8 @@ static_library("opus") {
"src/src/opus_multistream_decoder.c",
"src/src/opus_multistream_encoder.c",
"src/src/opus_private.h",
"src/src/opus_projection_encoder.c",
"src/src/opus_projection_decoder.c",
"src/src/opus_projection_encoder.c",
"src/src/repacketizer.c",
"src/src/tansig_table.h",
]

@ -303,10 +303,20 @@ template("proto_library") {
":$javascript_name",
":$source_set_name",
]
script = "//tools/protoc_wrapper/protoc_wrapper.py"
if ((defined(invoker.run_under_python2) && invoker.run_under_python2) ||
true) {
# TODO(crbug.com/1112471) - get all users of this to run cleanly under
# Python 3 and then remove this option.
script = "//build/util/python2_action.py"
args = [ rebase_path("//tools/protoc_wrapper/protoc_wrapper.py",
root_build_dir) ] + protos
} else {
script = "//tools/protoc_wrapper/protoc_wrapper.py"
args = protos
}
sources = proto_sources
outputs = get_path_info(protogens + protogens_cc + protogens_js, "abspath")
args = protos
if (defined(invoker.testonly)) {
testonly = invoker.testonly

@ -1,8 +1,10 @@
import("//build/config/python.gni")
import("//third_party/protobuf/proto_library.gni")
# Since most of the Chromium uses proto_lite, modify the source proto file to
# use the lite runtime.
action("quic_trace_proto_lite_runtime") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("quic_trace_proto_lite_runtime") {
script = "append_lite_runtime.py"
inputs = [ "src/lib/quic_trace.proto" ]
outputs = [ "$target_gen_dir/quic_trace.proto" ]
@ -19,6 +21,9 @@ proto_library("quic_trace_proto") {
"//net/third_party/quiche:quic_test_tools_core",
]
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
run_under_python2 = true
sources = [ "$target_gen_dir/quic_trace.proto" ]
proto_deps = [ ":quic_trace_proto_lite_runtime" ]
component_build_force_source_set = true

@ -9,6 +9,7 @@
# sources = [ "foo.xml" ]
# }
import("//build/config/python.gni")
import("//third_party/wayland/features.gni")
template("wayland_protocol") {
@ -33,7 +34,8 @@ template("wayland_protocol") {
source_set_name = "${target_name}"
# Action which runs wayland-scanner to generate the code.
action(action_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(action_name) {
visibility = [ ":$source_set_name" ]
script = "//third_party/wayland/wayland_scanner_wrapper.py"
sources = invoker.sources

@ -67,11 +67,17 @@
# configs (optional)
# List of additional configs to be applied to the generated target.
#
# run_under_python2 (optional)
# If true, this is always run under Python2; if false (the default),
# will be run under whatever script_executable actually is.
# TODO(crbug.com/1112471): Find all users of this and get them to
# run cleanly under Python3, then remove this option.
# deps (optional)
# testonly (optional)
# visibility (optional)
# Normal meaning.
#
#
# Example
#
# grit("my_resources") {
@ -138,12 +144,27 @@ template("grit") {
_grit_custom_target = target_name + "_grit"
action(_grit_custom_target) {
# TODO(crbug.com/1112471): Remove the 'true' branch so that we can start
# running *some* grit invocations under python3, and then get them
# all to work under python3.
if ((defined(invoker.run_under_python2) && invoker.run_under_python2) ||
true) {
script = "//build/util/python2_action.py"
args = [ rebase_path("//tools/grit/grit.py", root_build_dir) ]
inputs = [
"//tools/grit/grit.py",
invoker.source,
]
} else {
script = "//tools/grit/grit.py"
args = []
inputs = [ invoker.source ]
}
testonly = defined(invoker.testonly) && invoker.testonly
script = "//tools/grit/grit.py"
depfile = "$target_gen_dir/$target_name.d"
inputs = [ invoker.source ]
deps = [ "//tools/grit:grit_sources" ]
outputs = [ "${depfile}.stamp" ] + _grit_outputs + _pak_info_outputs
@ -179,19 +200,19 @@ template("grit") {
inputs += rebase_path(_rel_inputs, ".", root_build_dir)
}
args = [
"-i",
_rebased_source_path,
"build",
"-o",
rebase_path(_output_dir, root_build_dir),
"--depdir",
".",
"--depfile",
rebase_path(depfile, root_build_dir),
"--write-only-new=1",
"--depend-on-stamp",
] + _grit_flags
args += [
"-i",
_rebased_source_path,
"build",
"-o",
rebase_path(_output_dir, root_build_dir),
"--depdir",
".",
"--depfile",
rebase_path(depfile, root_build_dir),
"--write-only-new=1",
"--depend-on-stamp",
] + _grit_flags
# Add brotli executable if using brotli.
if (defined(invoker.use_brotli) && invoker.use_brotli) {

@ -2,10 +2,12 @@
# 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")
import("//tools/grit/grit_defines.gni")
template("preprocess_grit") {
action(target_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(target_name) {
script = "//tools/grit/preprocess_grit.py"
if (defined(invoker.deps)) {

@ -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")
# Generates the FeatureProviders files for extension features files.
# The following variables are required:
# sources: The features.json files to use.
@ -27,7 +29,8 @@ template("json_features") {
"$target_gen_dir/$base_filename.h",
]
action(action_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action(action_name) {
visibility = [ ":$source_set_name" ]
sources = invoker.sources
script = "$compiler_root/feature_compiler.py"

@ -36,6 +36,8 @@
# A specific visibility to apply for the generated static library. If
# omitted, visibility will be inherited from the invoker.
import("//build/config/python.gni")
# NOTE: Common variables here for when multiple templates use them.
compiler_root = "//tools/json_schema_compiler"
compiler_script = "$compiler_root/compiler.py"
@ -317,7 +319,9 @@ template("generated_types") {
root_target_name = target_name
schema_generator_name = target_name + "_schema_generator"
action_foreach(schema_generator_name) {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action_foreach(schema_generator_name) {
visibility = [ ":$root_target_name" ]
script = compiler_script
sources = invoker.sources

@ -2,7 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
action("usb_gadget") {
import("//build/config/python.gni")
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("usb_gadget") {
script = "//tools/usb_gadget/package.py"
inputs = [
"__init__.py",

@ -4,6 +4,7 @@
import("//build/buildflag_header.gni")
import("//build/config/ozone.gni")
import("//build/config/python.gni")
import("//build/config/ui.gni")
import("//gpu/vulkan/features.gni")
import("//testing/test.gni")
@ -282,7 +283,8 @@ static_library("test_support") {
public_deps = [ ":test_support_internal" ]
}
action("generate_ozone_platform_list") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("generate_ozone_platform_list") {
script = "generate_ozone_platform_list.py"
outputs = [
platform_list_cc_file,
@ -301,7 +303,8 @@ action("generate_ozone_platform_list") {
visibility += [ "//media:*" ]
}
action("generate_constructor_list") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("generate_constructor_list") {
script = "generate_constructor_list.py"
inputs = [ platform_list_txt_file ]
@ -321,7 +324,8 @@ action("generate_constructor_list") {
deps = [ ":generate_ozone_platform_list" ]
}
action("generate_test_support_constructor_list") {
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
python2_action("generate_test_support_constructor_list") {
script = "generate_constructor_list.py"
inputs = [ platform_list_txt_file ]