diff options
| author | David Schulz <david.schulz@qt.io> | 2023-11-01 15:05:03 +0100 |
|---|---|---|
| committer | David Schulz <david.schulz@qt.io> | 2023-11-28 12:17:14 +0000 |
| commit | 09e94ae4ac040ad313b7b86e62489dee7cd3804a (patch) | |
| tree | 1e907c076ba18b326b413ed5ac551db4a3e5e380 /src/plugins/python/pythonutils.cpp | |
| parent | 12428bf1d67bd282c5276383c91d968451b44036 (diff) | |
Python: use kits page in python wizards
Change-Id: I1f7aaf145443481546abb868c8c167186600b848
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/python/pythonutils.cpp')
| -rw-r--r-- | src/plugins/python/pythonutils.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index 43d23a256bc..97d118f1229 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -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 |
