| Index: net/test/python_utils.cc
|
| diff --git a/net/test/python_utils.cc b/net/test/python_utils.cc
|
| index 868abbb4e35de62e08eeb05529d32a960766269d..57429626b17c2bd30633a1f054e10e3a4476cb6e 100644
|
| --- a/net/test/python_utils.cc
|
| +++ b/net/test/python_utils.cc
|
| @@ -23,6 +23,7 @@
|
| #endif
|
|
|
| const char kPythonPathEnv[] = "PYTHONPATH";
|
| +const char kPythonVirtualEnv[] = "VIRTUAL_ENV";
|
|
|
| void ClearPythonPath() {
|
| std::unique_ptr<base::Environment> env(base::Environment::Create());
|
| @@ -102,6 +103,10 @@ struct PythonExePath {
|
| static base::LazyInstance<PythonExePath>::Leaky g_python_path;
|
| #endif
|
|
|
| +bool IsInPythonVirtualEnv() {
|
| + return base::Environment::Create()->HasVar(kPythonVirtualEnv);
|
| +}
|
| +
|
| bool GetPythonCommand(base::CommandLine* python_cmd) {
|
| DCHECK(python_cmd);
|
|
|
| @@ -121,8 +126,10 @@ bool GetPythonCommand(base::CommandLine* python_cmd) {
|
| // gtest output in buildbot log files. See http://crbug.com/147368.
|
| python_cmd->AppendArg("-u");
|
|
|
| - // Prevent using system-installed libraries. Use hermetic versioned copies.
|
| - python_cmd->AppendArg("-S");
|
| + if (!IsInPythonVirtualEnv()) {
|
| + // Prevent using system-installed libraries. Use hermetic versioned copies.
|
| + python_cmd->AppendArg("-S");
|
| + }
|
|
|
| return true;
|
| }
|
|
|