From 4f7865eb4dc966538d82bb4bc4c403732722d1ea Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 14 Nov 2023 11:18:47 +0100 Subject: [PATCH] Python: Limit detection to unique python In case we are having symbolic links on python or its parent path(s) we added an interpreter for each of these. Resolve the python path explicitly and only add them if they are unique. Change-Id: I21b9d7d85e82c5ec3a18e182dfcde2b98936a8af Reviewed-by: David Schulz --- src/plugins/python/pythonsettings.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index 256919b0317..fdd49f9842d 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -690,12 +690,15 @@ static QList pythonsFromPath() "python[1-9].[1-9][0-9]", "python[1-9]"}; const FilePaths dirs = Environment::systemEnvironment().path(); + QSet used; for (const FilePath &path : dirs) { const QDir dir(path.toString()); for (const QFileInfo &fi : dir.entryInfoList(filters)) { - const FilePath executable = Utils::FilePath::fromFileInfo(fi); - if (executable.exists()) + const FilePath executable = FilePath::fromUserInput(fi.canonicalFilePath()); + if (!used.contains(executable) && executable.exists()) { + used.insert(executable); pythons << createInterpreter(executable, "Python from Path"); + } } } }