summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 02:40:50 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 02:40:50 +0000
commitaa134c982fec3acc60bda01acae6f68b283a0976 (patch)
tree7a879f84f9e8e6436a705b174d3bd01c15ea4a8a /net
parent9d95c76f07c0c26c882c667c81e3a6ffadc8fc74 (diff)
downloadchromium_src-aa134c982fec3acc60bda01acae6f68b283a0976.zip
chromium_src-aa134c982fec3acc60bda01acae6f68b283a0976.tar.gz
chromium_src-aa134c982fec3acc60bda01acae6f68b283a0976.tar.bz2
Don't append tlslite to PYTHONPATH more than once
Review URL: http://codereview.chromium.org/14037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6876 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/url_request/url_request_unittest.h35
1 files changed, 20 insertions, 15 deletions
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h
index a657097..e2b8ca3 100644
--- a/net/url_request/url_request_unittest.h
+++ b/net/url_request/url_request_unittest.h
@@ -312,21 +312,26 @@ class TestServer : public base::ProcessFilter {
// Set up PYTHONPATH so that Python is able to find the in-tree copy of
// tlslite.
- FilePath tlslite_path;
- ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &tlslite_path));
- tlslite_path = tlslite_path.Append("third_party");
- tlslite_path = tlslite_path.Append("tlslite");
-
- const char kPythonPath[] = "PYTHONPATH";
- char* python_path_c = getenv(kPythonPath);
- if (python_path_c) {
- // PYTHONPATH is already set, append to it.
- std::string python_path(python_path_c);
- python_path.append(":");
- python_path.append(tlslite_path.value());
- setenv(kPythonPath, python_path.c_str(), 1);
- } else {
- setenv(kPythonPath, tlslite_path.value().c_str(), 1);
+ static bool set_python_path = false;
+ if (!set_python_path) {
+ FilePath tlslite_path;
+ ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &tlslite_path));
+ tlslite_path = tlslite_path.Append("third_party");
+ tlslite_path = tlslite_path.Append("tlslite");
+
+ const char kPythonPath[] = "PYTHONPATH";
+ char* python_path_c = getenv(kPythonPath);
+ if (python_path_c) {
+ // PYTHONPATH is already set, append to it.
+ std::string python_path(python_path_c);
+ python_path.append(":");
+ python_path.append(tlslite_path.value());
+ setenv(kPythonPath, python_path.c_str(), 1);
+ } else {
+ setenv(kPythonPath, tlslite_path.value().c_str(), 1);
+ }
+
+ set_python_path = true;
}
std::vector<std::string> command_line;