Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: tools/gn/setup.cc

Issue 1978693002: GN: Allow setting the path to Python (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/setup.h ('k') | tools/gn/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/setup.cc
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc
index 7f8e28685dc6fe9117e427183e0b9f4f82bc8550..ea7cb240908b701dd1d2ebf332adf09540505519 100644
--- a/tools/gn/setup.cc
+++ b/tools/gn/setup.cc
@@ -299,7 +299,7 @@ bool Setup::DoSetup(const std::string& build_dir, bool force_create) {
if (!FillArguments(*cmdline))
return false;
}
- FillPythonPath();
+ FillPythonPath(*cmdline);
return true;
}
@@ -594,20 +594,25 @@ bool Setup::FillBuildDir(const std::string& build_dir, bool require_exists) {
return true;
}
-void Setup::FillPythonPath() {
+void Setup::FillPythonPath(const base::CommandLine& cmdline) {
// Trace this since it tends to be a bit slow on Windows.
ScopedTrace setup_trace(TraceItem::TRACE_SETUP, "Fill Python Path");
+ if (cmdline.HasSwitch(switches::kScriptExecutable)) {
+ build_settings_.set_python_path(
+ cmdline.GetSwitchValuePath(switches::kScriptExecutable));
+ } else {
#if defined(OS_WIN)
- base::FilePath python_path = FindWindowsPython();
- if (python_path.empty()) {
- scheduler_.Log("WARNING", "Could not find python on path, using "
- "just \"python.exe\"");
- python_path = base::FilePath(kPythonExeName);
- }
- build_settings_.set_python_path(python_path.NormalizePathSeparatorsTo('/'));
+ base::FilePath python_path = FindWindowsPython();
+ if (python_path.empty()) {
+ scheduler_.Log("WARNING", "Could not find python on path, using "
+ "just \"python.exe\"");
+ python_path = base::FilePath(kPythonExeName);
+ }
+ build_settings_.set_python_path(python_path.NormalizePathSeparatorsTo('/'));
#else
- build_settings_.set_python_path(base::FilePath("python"));
+ build_settings_.set_python_path(base::FilePath("python"));
#endif
+ }
}
bool Setup::RunConfigFile() {
« no previous file with comments | « tools/gn/setup.h ('k') | tools/gn/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698