|
|
@ -190,9 +190,17 @@ namespace |
|
|
|
path = getRegValue(hkInstallPath); |
|
|
|
path = getRegValue(hkInstallPath); |
|
|
|
::RegCloseKey(hkInstallPath); |
|
|
|
::RegCloseKey(hkInstallPath); |
|
|
|
|
|
|
|
|
|
|
|
if (!path.isEmpty() && QDir(path).exists("python.exe")) { |
|
|
|
if (!path.isEmpty()) { |
|
|
|
|
|
|
|
const QDir baseDir {path}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (baseDir.exists("python3.exe")) { |
|
|
|
|
|
|
|
found = true; |
|
|
|
|
|
|
|
path = baseDir.filePath("python3.exe"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (baseDir.exists("python.exe")) { |
|
|
|
found = true; |
|
|
|
found = true; |
|
|
|
path = QDir(path).filePath("python.exe"); |
|
|
|
path = baseDir.filePath("python.exe"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -223,9 +231,13 @@ namespace |
|
|
|
// Fallback: Detect python from default locations
|
|
|
|
// Fallback: Detect python from default locations
|
|
|
|
const QFileInfoList dirs = QDir("C:/").entryInfoList({"Python*"}, QDir::Dirs, (QDir::Name | QDir::Reversed)); |
|
|
|
const QFileInfoList dirs = QDir("C:/").entryInfoList({"Python*"}, QDir::Dirs, (QDir::Name | QDir::Reversed)); |
|
|
|
for (const QFileInfo &info : dirs) { |
|
|
|
for (const QFileInfo &info : dirs) { |
|
|
|
const QString path {info.absolutePath() + "/python.exe"}; |
|
|
|
const QString py3Path {info.absolutePath() + "/python3.exe"}; |
|
|
|
if (QFile::exists(path)) |
|
|
|
if (QFile::exists(py3Path)) |
|
|
|
return path; |
|
|
|
return py3Path; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QString pyPath {info.absolutePath() + "/python.exe"}; |
|
|
|
|
|
|
|
if (QFile::exists(pyPath)) |
|
|
|
|
|
|
|
return pyPath; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return {}; |
|
|
|
return {}; |
|
|
@ -247,14 +259,9 @@ PythonInfo Utils::ForeignApps::pythonInfo() |
|
|
|
{ |
|
|
|
{ |
|
|
|
static PythonInfo pyInfo; |
|
|
|
static PythonInfo pyInfo; |
|
|
|
if (!pyInfo.isValid()) { |
|
|
|
if (!pyInfo.isValid()) { |
|
|
|
#if defined(Q_OS_UNIX) |
|
|
|
|
|
|
|
// On Unix-Like systems python3 should always exist
|
|
|
|
|
|
|
|
// https://www.python.org/dev/peps/pep-0394/
|
|
|
|
|
|
|
|
if (testPythonInstallation("python3", pyInfo)) |
|
|
|
if (testPythonInstallation("python3", pyInfo)) |
|
|
|
return pyInfo; |
|
|
|
return pyInfo; |
|
|
|
#endif |
|
|
|
|
|
|
|
// Look for "python" in Windows and in UNIX if "python3" is
|
|
|
|
|
|
|
|
// not detected.
|
|
|
|
|
|
|
|
if (testPythonInstallation("python", pyInfo)) |
|
|
|
if (testPythonInstallation("python", pyInfo)) |
|
|
|
return pyInfo; |
|
|
|
return pyInfo; |
|
|
|
|
|
|
|
|
|
|
|