Python: Improve auto detection

Do not list app installer redirectors as python
executables. Windows may put empty redirector files
with the same name in a path that is prepended to
PATH for the respective user.

Change-Id: I9418784ef099df72ef8d0426e55198b30fbeed6a
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2020-11-10 10:28:10 +01:00
parent 5d1c789c27
commit d60fa5c762

View File

@@ -405,6 +405,9 @@ static void addPythonsFromPath(QList<Interpreter> &pythons)
if (HostOsInfo::isWindowsHost()) {
for (const FilePath &executable : env.findAllInPath("python")) {
// Windows creates empty redirector files that may interfere
if (executable.toFileInfo().size() == 0)
continue;
if (executable.exists() && !alreadyRegistered(pythons, executable))
pythons << Interpreter(executable, "Python from Path");
}