python_utils.h 912 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (c) 2010 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef NET_TEST_PYTHON_UTILS_H_
  5. #define NET_TEST_PYTHON_UTILS_H_
  6. #include <vector>
  7. #include "base/environment.h"
  8. namespace base {
  9. class CommandLine;
  10. class FilePath;
  11. }
  12. // Modifies |map| to use the specified Python path.
  13. void SetPythonPathInEnvironment(const std::vector<base::FilePath>& python_path,
  14. base::EnvironmentMap* map);
  15. // Returns if a virtualenv is currently active.
  16. bool IsInPythonVirtualEnv();
  17. // Returns the command that should be used to launch Python.
  18. [[nodiscard]] bool GetPythonCommand(base::CommandLine* python_cmd);
  19. // Returns the command that should be used to launch Python 3.
  20. [[nodiscard]] bool GetPython3Command(base::CommandLine* python_cmd);
  21. #endif // NET_TEST_PYTHON_UTILS_H_