Python: show warnings if pip or venv is missing

Change-Id: Ib38c1eb3b0f31d6988d3a5f084ac6eda08ec0619
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-11-22 11:09:41 +01:00
parent 67b7835c25
commit f4bf7c5b00
4 changed files with 51 additions and 13 deletions

View File

@@ -192,4 +192,20 @@ bool isVenvPython(const Utils::FilePath &python)
return python.parentDir().parentDir().contains("pyvenv.cfg");
}
bool venvIsUsable(const Utils::FilePath &python)
{
Process process;
process.setCommand({python, QStringList{"-m", "venv", "-h"}});
process.runBlocking();
return process.result() == ProcessResult::FinishedWithSuccess;
}
bool pipIsUsable(const Utils::FilePath &python)
{
Process process;
process.setCommand({python, QStringList{"-m", "pip", "-V"}});
process.runBlocking();
return process.result() == ProcessResult::FinishedWithSuccess;
}
} // Python::Internal