Python: use kits page in python wizards

Change-Id: I1f7aaf145443481546abb868c8c167186600b848
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-11-01 15:05:03 +01:00
parent 12428bf1d6
commit 09e94ae4ac
33 changed files with 870 additions and 680 deletions

View File

@@ -3,6 +3,9 @@
#include "pythonutils.h"
#include "pythonbuildconfiguration.h"
#include "pythonconstants.h"
#include "pythonkitaspect.h"
#include "pythonproject.h"
#include "pythonsettings.h"
#include "pythontr.h"
@@ -38,14 +41,12 @@ FilePath detectPython(const FilePath &documentPath)
FilePaths dirs = Environment::systemEnvironment().path();
if (project) {
if (auto target = project->activeTarget()) {
if (auto runConfig = target->activeRunConfiguration()) {
if (auto interpreter = runConfig->aspect<InterpreterAspect>())
return interpreter->currentInterpreter().command;
if (auto environmentAspect = runConfig->aspect<EnvironmentAspect>())
dirs = environmentAspect->environment().path();
}
if (project && project->mimeType() == Constants::C_PY_PROJECT_MIME_TYPE) {
if (const Target *target = project->activeTarget()) {
if (auto bc = qobject_cast<PythonBuildConfiguration *>(target->activeBuildConfiguration()))
return bc->python();
if (const std::optional<Interpreter> python = PythonKitAspect::python(target->kit()))
return python->command;
}
}
@@ -186,4 +187,9 @@ void createVenv(const Utils::FilePath &python,
process->start();
}
bool isVenvPython(const Utils::FilePath &python)
{
return python.parentDir().parentDir().contains("pyvenv.cfg");
}
} // Python::Internal