| 670 | } |
| 671 | |
| 672 | void QmitkPipInstaller::StartPostInstallStep() |
| 673 | { |
| 674 | const auto python = this->RequirePythonExecutable(); |
| 675 | |
| 676 | if (python.isEmpty()) |
| 677 | return; |
| 678 | |
| 679 | if (m_CurrentPostInstallStep >= static_cast<int>(m_Spec.postInstallSteps.size())) |
| 680 | { |
| 681 | m_State = m_AnyFailed ? State::Failed : State::Done; |
| 682 | emit InstallFinished(!m_AnyFailed); |
| 683 | return; |
| 684 | } |
| 685 | |
| 686 | const auto& step = m_Spec.postInstallSteps[m_CurrentPostInstallStep]; |
| 687 | const auto displayName = QString::fromStdString( |
| 688 | step.displayName.empty() ? std::string("post-install step") : step.displayName); |
| 689 | |
| 690 | // Run the step's Python source verbatim via `python -c`. QProcess::start with |
| 691 | // a QStringList handles argument quoting on Windows. Any imports must be |
| 692 | // satisfied by packages installed in the preceding groups; stdout/stderr |
| 693 | // (including tqdm progress) flows to the UI details view via |
| 694 | // OnStandardOutputReady / OnStandardErrorReady -> OutputReceived. |
| 695 | const auto script = QString::fromStdString(step.pythonCode); |
| 696 | |
| 697 | emit PostInstallStepStarted(displayName); |
| 698 | |
| 699 | QStringList args = { "-c", script }; |
| 700 | MITK_INFO << FormatCommand(python, args).toStdString(); |
| 701 | m_Process->start(python, args); |
| 702 | } |
| 703 | |
| 704 | QString QmitkPipInstaller::PythonExecutable() const |
| 705 | { |
no test coverage detected