Stop referring to Python in exec_script.
exec_script can now execute non-Python scripts.
Change-Id: Ia48485c28036eb3a8cb3defffb556ad23a362dc2
Reviewed-on: https://gn-review.googlesource.com/2820
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
diff --git a/docs/reference.md b/docs/reference.md
index c7215df..277b3d8 100644
--- a/docs/reference.md
+++ b/docs/reference.md
@@ -1790,14 +1790,18 @@
directory. If you are passing file names, you will want to use the
rebase_path() function to make file names relative to this path (see "gn help
rebase_path").
+
+ The default script interpreter is Python ("python" on POSIX, "python.exe" or
+ "python.bat" on Windows). This can be configured by the script_executable
+ variable, see "gn help dotfile".
```
#### **Arguments**:
```
filename:
- File name of python script to execute. Non-absolute names will be treated
- as relative to the current build file.
+ File name of script to execute. Non-absolute names will be treated as
+ relative to the current build file.
arguments:
A list of strings to be passed to the script as arguments. May be
diff --git a/tools/gn/function_exec_script.cc b/tools/gn/function_exec_script.cc
index 15621b7..89570db 100644
--- a/tools/gn/function_exec_script.cc
+++ b/tools/gn/function_exec_script.cc
@@ -80,11 +80,15 @@
rebase_path() function to make file names relative to this path (see "gn help
rebase_path").
+ The default script interpreter is Python ("python" on POSIX, "python.exe" or
+ "python.bat" on Windows). This can be configured by the script_executable
+ variable, see "gn help dotfile".
+
Arguments:
filename:
- File name of python script to execute. Non-absolute names will be treated
- as relative to the current build file.
+ File name of script to execute. Non-absolute names will be treated as
+ relative to the current build file.
arguments:
A list of strings to be passed to the script as arguments. May be
@@ -133,7 +137,7 @@
if (!CheckExecScriptPermissions(build_settings, function, err))
return Value();
- // Find the python script to run.
+ // Find the script to run.
std::string script_source_path = cur_dir.ResolveRelativeAs(
true, args[0], err,
scope->settings()->build_settings()->root_path_utf8());
@@ -173,8 +177,8 @@
}
// Make the command line.
- const base::FilePath& python_path = build_settings->python_path();
- base::CommandLine cmdline(python_path);
+ const base::FilePath& interpreter_path = build_settings->python_path();
+ base::CommandLine cmdline(interpreter_path);
// CommandLine tries to interpret arguments by default. Disable that so
// that the arguments will be passed through exactly as specified.
@@ -199,10 +203,10 @@
Ticks begin_exec = 0;
if (g_scheduler->verbose_logging()) {
#if defined(OS_WIN)
- g_scheduler->Log("Pythoning",
+ g_scheduler->Log("Executing",
base::UTF16ToUTF8(cmdline.GetCommandLineString()));
#else
- g_scheduler->Log("Pythoning", cmdline.GetCommandLineString());
+ g_scheduler->Log("Executing", cmdline.GetCommandLineString());
#endif
begin_exec = TicksNow();
}
@@ -227,14 +231,15 @@
if (!internal::ExecProcess(cmdline, startup_dir, &output, &stderr_output,
&exit_code)) {
*err = Err(
- function->function(), "Could not execute python.",
- "I was trying to execute \"" + FilePathToUTF8(python_path) + "\".");
+ function->function(), "Could not execute interpreter.",
+ "I was trying to execute \"" + FilePathToUTF8(interpreter_path) +
+ "\".");
return Value();
}
}
if (g_scheduler->verbose_logging()) {
g_scheduler->Log(
- "Pythoning",
+ "Executing",
script_source_path + " took " +
base::Int64ToString(
TicksDelta(TicksNow(), begin_exec).InMilliseconds()) +