MCPcopy Create free account
hub / github.com/NatLabRockies/SAM / InstallPythonPackage

Method InstallPythonPackage

src/main.cpp:2761–2779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2759}
2760
2761void SamApp::InstallPythonPackage(const std::string& pip_name) {
2762 if (CheckPythonPackageInstalled(pip_name, pythonConfig))
2763 return;
2764 auto packageConfig = ReadPythonPackageConfig(pip_name, GetPythonConfigPath() + "/" + pip_name + ".json");
2765
2766#ifdef __WXMSW__
2767 bool retval = InstallFromPipWindows(GetPythonConfigPath() + "\\" + pythonConfig.pipPath, packageConfig);
2768#else
2769 std::string pip_exec = GetPythonConfigPath() + "/" + pythonConfig.pipPath;
2770 bool retval = InstallFromPip(pip_exec, packageConfig);
2771#endif
2772 if (retval == 0){
2773 pythonConfig.packages.push_back(pip_name);
2774 WritePythonConfig(GetPythonConfigPath() + "/python_config.json", pythonConfig);
2775 }
2776 else {
2777 throw std::runtime_error("Error installing " + pip_name);
2778 }
2779}
2780
2781enum { ID_TechTree = wxID_HIGHEST+98, ID_FinTree };
2782

Callers

nothing calls this directly

Calls 5

ReadPythonPackageConfigFunction · 0.85
InstallFromPipWindowsFunction · 0.85
InstallFromPipFunction · 0.85
WritePythonConfigFunction · 0.85

Tested by

no test coverage detected