| 454 | } |
| 455 | |
| 456 | void QmitkPipInstaller::StartResolveGroup() |
| 457 | { |
| 458 | const auto python = this->RequirePythonExecutable(); |
| 459 | |
| 460 | if (python.isEmpty()) |
| 461 | return; |
| 462 | |
| 463 | if (m_CurrentGroup >= static_cast<int>(m_Groups.size())) |
| 464 | { |
| 465 | this->BeginPostInstallPhase(); |
| 466 | return; |
| 467 | } |
| 468 | |
| 469 | m_GroupStartIndex = static_cast<int>(m_ResolvedPackages.size()); |
| 470 | const auto& group = m_Groups[m_CurrentGroup]; |
| 471 | |
| 472 | // m_ReportFile is reused across groups: the underlying temp file path is |
| 473 | // stable for the lifetime of this QmitkPipInstaller, but we close the Qt |
| 474 | // handle each time so pip can write to the path freely. The file is deleted |
| 475 | // when the QTemporaryFile object is destroyed. |
| 476 | m_ReportFile.close(); |
| 477 | |
| 478 | if (!m_ReportFile.open()) |
| 479 | { |
| 480 | m_State = State::Failed; |
| 481 | emit ErrorOccurred("Could not create temporary file for pip report."); |
| 482 | emit InstallFinished(false); |
| 483 | return; |
| 484 | } |
| 485 | |
| 486 | const auto reportPath = m_ReportFile.fileName(); |
| 487 | m_ReportFile.close(); |
| 488 | |
| 489 | QStringList args = { "-m", "pip", "install", "--dry-run", "--report", reportPath }; |
| 490 | args = this->BuildPipArgs(args, group); |
| 491 | |
| 492 | for (const auto& req : group.requirements) |
| 493 | args.append(QString::fromStdString(req)); |
| 494 | |
| 495 | m_State = State::Resolving; |
| 496 | MITK_INFO << FormatCommand(python, args).toStdString(); |
| 497 | m_Process->start(python, args); |
| 498 | } |
| 499 | |
| 500 | void QmitkPipInstaller::StartInstallPackage() |
| 501 | { |
no test coverage detected