| 339 | } |
| 340 | |
| 341 | bool AbstractPythonInterface::checkVenv(bool calculateSize, bool forceInstall) |
| 342 | { |
| 343 | if (useSystemPython()) { |
| 344 | return true; |
| 345 | } |
| 346 | if (installInProgress) { |
| 347 | qDebug() << "...... ANOTHER INSTALL IN PROGRESS.."; |
| 348 | return false; |
| 349 | } |
| 350 | |
| 351 | QMutexLocker bk(&mutex); |
| 352 | |
| 353 | QDir pluginDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); |
| 354 | QString binPath = getVenvBinPath(); |
| 355 | |
| 356 | qDebug() << "++++++ \n\nCHECKING PYTHON PATH FROM: " << pluginDir.absolutePath() << ", FOLDER: " << binPath << ", FORCING INSTALL: " << forceInstall; |
| 357 | |
| 358 | if (pluginDir.exists(binPath)) { |
| 359 | PythonExec execs = venvPythonExecs(true); |
| 360 | if (execs.python.isEmpty() || !QFile::exists(execs.python)) { |
| 361 | setStatus(Broken); |
| 362 | Q_EMIT setupError(i18n("Cannot find python3 in the kdenlive venv.\n" |
| 363 | "Try to uninstall and then reinstall the plugin.")); |
| 364 | if (calculateSize) { |
| 365 | Q_EMIT gotPythonSize(QString()); |
| 366 | } |
| 367 | return false; |
| 368 | } |
| 369 | if (execs.pip.isEmpty() || !QFile::exists(execs.pip)) { |
| 370 | Q_EMIT setupError(i18n("Cannot find pip3 in the kdenlive venv.\n" |
| 371 | "Try to uninstall and then reinstall the plugin.")); |
| 372 | if (calculateSize) { |
| 373 | Q_EMIT gotPythonSize(QString()); |
| 374 | } |
| 375 | setStatus(Broken); |
| 376 | return false; |
| 377 | } |
| 378 | |
| 379 | // Everything ok: calculate the size if requested and quit |
| 380 | if (calculateSize) { |
| 381 | calculateVenvSize(); |
| 382 | } |
| 383 | if (!forceInstall) { |
| 384 | setStatus(Installed); |
| 385 | return true; |
| 386 | } |
| 387 | } else { |
| 388 | // Venv folder not found |
| 389 | setStatus(NotInstalled); |
| 390 | if (calculateSize) { |
| 391 | Q_EMIT gotPythonSize(QString()); |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | if (!forceInstall) { |
| 396 | return false; |
| 397 | } |
| 398 | qDebug() << "================\n\nSTARTING INSTALL\n\n========================="; |
no test coverage detected