diff options
Diffstat (limited to 'GUI/GUI/GUI/PythonWrapper.cpp')
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index c353003..bcb7b1d 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -7,6 +7,7 @@ #include <stdio.h> #include <filesystem> +#include <fstream> #include <sstream> using ::Logging::Log; @@ -167,8 +168,21 @@ std::string PythonWrapper::DumpMics() { bool PythonWrapper::InstallPip(std::string* out) { std::string result; + std::filesystem::path pip_flag = "Resources/Python/.pip_installed"; + if (std::filesystem::exists(pip_flag)) { + return true; + } + std::string pip_path = "Resources/Python/get-pip.py"; - return InvokeWithArgs({ pip_path }, out); + if (!InvokeWithArgs({ pip_path }, out)) { + return false; + } + + // Create the flag file so subsstd::chrono::milliseconds(100));equent calls don't reinstall. + std::ofstream flag_ofs(pip_path); + flag_ofs.close(); + + return true; } wxProcess* PythonWrapper::StartApp( |
