MCPcopy Create free account
hub / github.com/Cantera/cantera / setPythonHome

Function setPythonHome

src/extensions/pythonShim.cpp:39–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38#ifdef _WIN32
39void setPythonHome()
40{
41 string pythonhome = "PYTHONHOME=";
42 const char* old_pythonhome = getenv("PYTHONHOME");
43 if (old_pythonhome != nullptr && old_pythonhome[0] != '\0') {
44 // Use existing setting of PYTHONHOME
45 return;
46 }
47
48 const char* conda_prefix = getenv("CONDA_PREFIX");
49 if (conda_prefix != nullptr && std::filesystem::exists(conda_prefix)) {
50 pythonhome += conda_prefix;
51 _putenv(pythonhome.c_str());
52 return;
53 }
54
55 #ifdef CT_PYTHONHOME
56 string build_pythonhome = stripnonprint(string(CT_PYTHONHOME));
57 if (std::filesystem::exists(build_pythonhome)) {
58 pythonhome += build_pythonhome;
59 _putenv(pythonhome.c_str());
60 }
61 #endif
62}
63#endif
64
65}

Callers 1

loadCanteraPythonFunction · 0.85

Calls 2

stripnonprintFunction · 0.85
existsFunction · 0.50

Tested by

no test coverage detected