[TOOLS] Force-use-vpython3-for-all-scripts: Force use vpython3 for all scripts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Do-not-link-with-libatomic.patch
|
||||
Force-use-vpython3-for-all-scripts.patch
|
||||
bromite-build-utils.patch
|
||||
Add-cromite-flags-support.patch
|
||||
Force-use-vpython3-for-some-scripts.patch
|
||||
Permit-PGO-for-debug-builds.patch
|
||||
Fix-chromium-vanilla.patch
|
||||
Final-patch-for-chromium-vanilla.patch
|
||||
@@ -165,7 +165,6 @@ Remove-HTTP-referrals-in-cross-origin-navigation.patch
|
||||
Enable-third-party-storage-partitioning.patch
|
||||
Restore-adaptive-button-in-top-toolbar-customization.patch
|
||||
Add-kill-switch-for-unsupported-clangd-flags.patch
|
||||
|
||||
WIN-enable-pdf-plugin.patch
|
||||
WIN-disable-annotate-downloads.patch
|
||||
Enable-HighEfficiencyMode-by-default.patch
|
||||
@@ -175,7 +174,6 @@ WIN-Disable-updater.patch
|
||||
WIN-Disable-first-run.patch
|
||||
WIN-Add-some-prefs-to-secure-preferences.patch
|
||||
WIN-Disable-search-for-image.patch
|
||||
|
||||
AudioBuffer-AnalyserNode-fp-mitigations.patch
|
||||
add-browser-policy.patch
|
||||
Always-open-browser-controls-in-new-tab.patch
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Thu, 5 Feb 2026 12:13:49 +0000
|
||||
Subject: Force use vpython3 for all scripts
|
||||
|
||||
Some scripts need the latest version of python not available in the docker container.
|
||||
The patch forces the use of python in the virtual environment in the version
|
||||
required by the chromium build tools.
|
||||
|
||||
License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
|
||||
---
|
||||
.gn | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.gn b/.gn
|
||||
--- a/.gn
|
||||
+++ b/.gn
|
||||
@@ -10,7 +10,7 @@ buildconfig = "//build/config/BUILDCONFIG.gn"
|
||||
|
||||
# The python interpreter to use by default. On Windows, this will look
|
||||
# for python3.exe and python3.bat.
|
||||
-script_executable = "python3"
|
||||
+script_executable = "vpython3"
|
||||
|
||||
# These arguments override the default values for items in a declare_args
|
||||
# block. "gn args" in turn can override these.
|
||||
--
|
||||
@@ -1,325 +0,0 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Fri, 2 May 2025 14:16:01 +0000
|
||||
Subject: Force use vpython3 for some scripts
|
||||
|
||||
Some scripts need the latest version of python not available in the docker container.
|
||||
The patch forces the use of python in the virtual environment in the version
|
||||
required by the chromium build tools.
|
||||
|
||||
License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
|
||||
---
|
||||
build/config/android/internal_rules.gni | 22 ++++++++++++++-----
|
||||
build/config/python.gni | 7 +++++-
|
||||
.../generate_expired_histograms_array.gni | 7 ++++--
|
||||
.../variations/field_trial_config/BUILD.gn | 4 +++-
|
||||
third_party/blink/renderer/bindings/BUILD.gn | 5 ++++-
|
||||
third_party/perfetto/gn/BUILD.gn | 5 ++++-
|
||||
tools/grit/grit_rule.gni | 4 +++-
|
||||
.../json_schema_compiler/json_schema_api.gni | 12 +++++++---
|
||||
tools/json_to_struct/json_to_struct.gni | 4 +++-
|
||||
...enerate_allowlist_from_histograms_file.gni | 5 +++--
|
||||
10 files changed, 56 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
|
||||
--- a/build/config/android/internal_rules.gni
|
||||
+++ b/build/config/android/internal_rules.gni
|
||||
@@ -627,12 +627,15 @@ template("write_build_config") {
|
||||
} else {
|
||||
action_with_pydeps(target_name) {
|
||||
forward_variables_from(invoker, [ "testonly" ])
|
||||
- script = "//build/android/gyp/write_build_config.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
+ original_script = "//build/android/gyp/write_build_config.py"
|
||||
depfile = "$target_gen_dir/$target_name.d"
|
||||
inputs = _inputs
|
||||
outputs = _outputs
|
||||
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(original_script),
|
||||
"--output",
|
||||
rebase_path(invoker.build_config, root_build_dir),
|
||||
"--depfile",
|
||||
@@ -3031,17 +3034,18 @@ if (enable_java_templates) {
|
||||
}
|
||||
|
||||
action_with_pydeps(target_name) {
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
if (invoker.use_turbine) {
|
||||
- script = "//build/android/gyp/turbine.py"
|
||||
+ original_script = "//build/android/gyp/turbine.py"
|
||||
inputs = [
|
||||
"//third_party/jdk/current/bin/java",
|
||||
android_sdk_jar,
|
||||
]
|
||||
} else if (invoker.enable_errorprone) {
|
||||
- script = "//build/android/gyp/errorprone.py"
|
||||
+ original_script = "//build/android/gyp/errorprone.py"
|
||||
inputs = javac_paths_for_inputs
|
||||
} else {
|
||||
- script = "//build/android/gyp/compile_java.py"
|
||||
+ original_script = "//build/android/gyp/compile_java.py"
|
||||
inputs = javac_paths_for_inputs
|
||||
}
|
||||
|
||||
@@ -3057,7 +3061,10 @@ if (enable_java_templates) {
|
||||
deps += invoker.deps
|
||||
}
|
||||
|
||||
- args = []
|
||||
+ args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(original_script),
|
||||
+ ]
|
||||
if (invoker.enable_errorprone) {
|
||||
_stamp_file = "$target_out_dir/$target_name.stamp"
|
||||
outputs = [ _stamp_file ]
|
||||
@@ -3256,7 +3263,8 @@ if (enable_java_templates) {
|
||||
}
|
||||
|
||||
action_with_pydeps(target_name) {
|
||||
- script = "//build/android/gyp/compile_kt.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
+ original_script = "//build/android/gyp/compile_kt.py"
|
||||
depfile = "$target_gen_dir/$target_name.d"
|
||||
deps = _srcjar_deps
|
||||
if (defined(invoker.deps)) {
|
||||
@@ -3285,6 +3293,8 @@ if (enable_java_templates) {
|
||||
"$target_gen_dir/${invoker.main_target_name}/generated_java",
|
||||
root_build_dir)
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(original_script),
|
||||
"--depfile=$_rebased_depfile",
|
||||
"--generated-dir=$_rebased_generated_dir",
|
||||
"--jar-path=$_rebased_output_jar_path",
|
||||
diff --git a/build/config/python.gni b/build/config/python.gni
|
||||
--- a/build/config/python.gni
|
||||
+++ b/build/config/python.gni
|
||||
@@ -91,6 +91,7 @@ template("action_with_pydeps") {
|
||||
[
|
||||
"testonly",
|
||||
"visibility",
|
||||
+ "original_script"
|
||||
])
|
||||
forward_variables_from(invoker,
|
||||
"*",
|
||||
@@ -102,7 +103,11 @@ template("action_with_pydeps") {
|
||||
# Read and filter out comments.
|
||||
# Happens every time the template is instantiated, but benchmarking shows no
|
||||
# perceivable impact on overall 'gn gen' speed.
|
||||
- _pydeps_file = invoker.script + "deps"
|
||||
+ if (!defined(original_script)) {
|
||||
+ _pydeps_file = invoker.script + "deps"
|
||||
+ } else {
|
||||
+ _pydeps_file = invoker.original_script + "deps"
|
||||
+ }
|
||||
|
||||
_pydeps_lines =
|
||||
read_file(_pydeps_file, "list lines") # https://crbug.com/1102058
|
||||
diff --git a/components/metrics/generate_expired_histograms_array.gni b/components/metrics/generate_expired_histograms_array.gni
|
||||
--- a/components/metrics/generate_expired_histograms_array.gni
|
||||
+++ b/components/metrics/generate_expired_histograms_array.gni
|
||||
@@ -30,7 +30,7 @@ template("generate_expired_histograms_array") {
|
||||
action(target_name) {
|
||||
header_filename = "$target_gen_dir/" + invoker.header_filename
|
||||
|
||||
- script = "//tools/metrics/histograms/generate_expired_histograms_array.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
outputs = [ header_filename ]
|
||||
|
||||
inputs = histograms_xml_files
|
||||
@@ -38,7 +38,10 @@ template("generate_expired_histograms_array") {
|
||||
major_branch_date_filepath = invoker.major_branch_date_filepath
|
||||
milestone_filepath = invoker.milestone_filepath
|
||||
|
||||
- args = []
|
||||
+ args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path("//tools/metrics/histograms/generate_expired_histograms_array.py")
|
||||
+ ]
|
||||
|
||||
if (defined(invoker.namespace) && invoker.namespace != "") {
|
||||
args += [ "-n" + invoker.namespace ]
|
||||
diff --git a/components/variations/field_trial_config/BUILD.gn b/components/variations/field_trial_config/BUILD.gn
|
||||
--- a/components/variations/field_trial_config/BUILD.gn
|
||||
+++ b/components/variations/field_trial_config/BUILD.gn
|
||||
@@ -5,7 +5,7 @@ import("//tools/json_to_struct/json_to_struct.gni")
|
||||
|
||||
action("field_trial_testing_config_action") {
|
||||
visibility = [ ":field_trial_config" ]
|
||||
- script = "//tools/variations/fieldtrial_to_struct.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
|
||||
source = "//testing/variations/fieldtrial_testing_config.json"
|
||||
inputs = JSON_TO_STRUCT_FILES + [ source ]
|
||||
@@ -22,6 +22,8 @@ action("field_trial_testing_config_action") {
|
||||
}
|
||||
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path("//tools/variations/fieldtrial_to_struct.py"),
|
||||
rebase_path(source, root_build_dir),
|
||||
"--destbase=" + rebase_path(target_gen_dir, root_build_dir),
|
||||
"--namespace=variations",
|
||||
diff --git a/third_party/blink/renderer/bindings/BUILD.gn b/third_party/blink/renderer/bindings/BUILD.gn
|
||||
--- a/third_party/blink/renderer/bindings/BUILD.gn
|
||||
+++ b/third_party/blink/renderer/bindings/BUILD.gn
|
||||
@@ -113,7 +113,8 @@ action_with_pydeps("web_idl_database") {
|
||||
"//testing/libfuzzer/research/fuzzilli_idl_fuzzing:*",
|
||||
]
|
||||
|
||||
- script = "scripts/build_web_idl_database.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
+ original_script = "scripts/build_web_idl_database.py"
|
||||
|
||||
input_data_files = get_target_outputs(":web_idl_in_core") +
|
||||
get_target_outputs(":web_idl_in_core_for_testing") +
|
||||
@@ -139,6 +140,8 @@ action_with_pydeps("web_idl_database") {
|
||||
outputs = [ web_idl_database_filepath ]
|
||||
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(original_script),
|
||||
"--output",
|
||||
rebase_path(web_idl_database_filepath, root_build_dir),
|
||||
"--runtime_enabled_features",
|
||||
diff --git a/third_party/perfetto/gn/BUILD.gn b/third_party/perfetto/gn/BUILD.gn
|
||||
--- a/third_party/perfetto/gn/BUILD.gn
|
||||
+++ b/third_party/perfetto/gn/BUILD.gn
|
||||
@@ -36,7 +36,8 @@ if (perfetto_root_path == "//") {
|
||||
# pattern #if PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD)
|
||||
buildflag_gen_dir_ = "$root_gen_dir/$perfetto_root_path/build_config"
|
||||
action("gen_buildflags") {
|
||||
- script = "write_buildflag_header.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
+ original_script = "write_buildflag_header.py"
|
||||
gen_header_path = "$buildflag_gen_dir_/perfetto_build_flags.h"
|
||||
|
||||
perfetto_component_build = false
|
||||
@@ -115,6 +116,8 @@ action("gen_buildflags") {
|
||||
|
||||
rel_out_path = rebase_path(gen_header_path, "$root_build_dir")
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(original_script),
|
||||
"--out",
|
||||
rel_out_path,
|
||||
"--rsp",
|
||||
diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni
|
||||
--- a/tools/grit/grit_rule.gni
|
||||
+++ b/tools/grit/grit_rule.gni
|
||||
@@ -154,7 +154,7 @@ template("grit") {
|
||||
|
||||
_grit_custom_target = target_name + "_grit"
|
||||
action(_grit_custom_target) {
|
||||
- script = "//tools/grit/grit.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
inputs = [ invoker.source ]
|
||||
|
||||
testonly = defined(invoker.testonly) && invoker.testonly
|
||||
@@ -197,6 +197,8 @@ template("grit") {
|
||||
}
|
||||
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path("//tools/grit/grit.py"),
|
||||
"-i",
|
||||
_rebased_source_path,
|
||||
"build",
|
||||
diff --git a/tools/json_schema_compiler/json_schema_api.gni b/tools/json_schema_compiler/json_schema_api.gni
|
||||
--- a/tools/json_schema_compiler/json_schema_api.gni
|
||||
+++ b/tools/json_schema_compiler/json_schema_api.gni
|
||||
@@ -112,13 +112,15 @@ template("generated_json_strings") {
|
||||
|
||||
action(bundle_generator_schema_name) {
|
||||
visibility = [ ":$root_target_name" ]
|
||||
- script = compiler_script
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
inputs = compiler_sources + invoker.sources
|
||||
outputs = [
|
||||
"$target_gen_dir/generated_schemas.cc",
|
||||
"$target_gen_dir/generated_schemas.h",
|
||||
]
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(compiler_script),
|
||||
"--root=" + rebase_path(root_folder, root_build_dir),
|
||||
"--destdir=$destdir",
|
||||
"--namespace=$root_namespace",
|
||||
@@ -227,13 +229,15 @@ template("function_registration") {
|
||||
|
||||
action(bundle_generator_registration_name) {
|
||||
visibility = [ ":$root_target_name" ]
|
||||
- script = compiler_script
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
inputs = compiler_sources + invoker.sources
|
||||
outputs = [
|
||||
"$gen_child_dir/generated_api_registration.cc",
|
||||
"$gen_child_dir/generated_api_registration.h",
|
||||
]
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(compiler_script),
|
||||
"--root=" + rebase_path(root_folder, root_build_dir),
|
||||
"--destdir=$destdir",
|
||||
"--namespace=$root_namespace",
|
||||
@@ -321,7 +325,7 @@ template("generated_types") {
|
||||
|
||||
action_foreach(schema_generator_name) {
|
||||
visibility = [ ":$root_target_name" ]
|
||||
- script = compiler_script
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
sources = invoker.sources
|
||||
inputs = compiler_sources
|
||||
outputs = [
|
||||
@@ -329,6 +333,8 @@ template("generated_types") {
|
||||
"$target_gen_dir/{{source_name_part}}.h",
|
||||
]
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path(compiler_script),
|
||||
"{{source}}",
|
||||
"--root=" + rebase_path(root_folder, root_build_dir),
|
||||
"--destdir=$destdir",
|
||||
diff --git a/tools/json_to_struct/json_to_struct.gni b/tools/json_to_struct/json_to_struct.gni
|
||||
--- a/tools/json_to_struct/json_to_struct.gni
|
||||
+++ b/tools/json_to_struct/json_to_struct.gni
|
||||
@@ -41,7 +41,7 @@ template("json_to_struct") {
|
||||
|
||||
action(action_name) {
|
||||
visibility = [ ":$source_set_name" ]
|
||||
- script = "//tools/json_to_struct/json_to_struct.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
|
||||
inputs = JSON_TO_STRUCT_FILES + [
|
||||
invoker.source,
|
||||
@@ -56,6 +56,8 @@ template("json_to_struct") {
|
||||
]
|
||||
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path("//tools/json_to_struct/json_to_struct.py"),
|
||||
rebase_path(invoker.source, root_build_dir),
|
||||
"--destbase=" + rebase_path(out_dir, root_build_dir),
|
||||
"--namespace=" + invoker.namespace,
|
||||
diff --git a/tools/metrics/generate_allowlist_from_histograms_file.gni b/tools/metrics/generate_allowlist_from_histograms_file.gni
|
||||
--- a/tools/metrics/generate_allowlist_from_histograms_file.gni
|
||||
+++ b/tools/metrics/generate_allowlist_from_histograms_file.gni
|
||||
@@ -28,12 +28,13 @@ template("generate_allowlist_from_histograms_file") {
|
||||
action_with_pydeps(target_name) {
|
||||
output_file = "$target_gen_dir/" + invoker.output_file
|
||||
|
||||
- script =
|
||||
- "//tools/metrics/histograms/generate_allowlist_from_histograms_file.py"
|
||||
+ script = "//build/gn_run_binary.py"
|
||||
outputs = [ output_file ]
|
||||
sources = [ invoker.input_xml_file ]
|
||||
|
||||
args = [
|
||||
+ rebase_path("//third_party/depot_tools/vpython3"),
|
||||
+ rebase_path("//tools/metrics/histograms/generate_allowlist_from_histograms_file.py"),
|
||||
"--allow_list_name=" + invoker.allow_list_name,
|
||||
"--namespace=" + invoker.namespace,
|
||||
"--tag=" + invoker.tag,
|
||||
--
|
||||
Reference in New Issue
Block a user