mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
Revert "Drop python2 support.". Closes #7005.
This reverts commit 7d030b4cd9.
This commit is contained in:
@@ -238,11 +238,14 @@ QPoint Utils::Misc::screenCenter(const QWidget *w)
|
||||
int Utils::Misc::pythonVersion()
|
||||
{
|
||||
static int version = -1;
|
||||
if (version != 3) {
|
||||
if (version < 0) {
|
||||
QString versionComplete = pythonVersionComplete().trimmed();
|
||||
QStringList splitted = versionComplete.split('.');
|
||||
if (splitted.size() > 1)
|
||||
version = splitted.at(0).toInt();
|
||||
if (splitted.size() > 1) {
|
||||
int highVer = splitted.at(0).toInt();
|
||||
if ((highVer == 2) || (highVer == 3))
|
||||
version = highVer;
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
@@ -265,6 +268,11 @@ QString Utils::Misc::pythonExecutable()
|
||||
executable = "python3";
|
||||
return executable;
|
||||
}
|
||||
pythonProc.start("python2", QStringList() << "--version", QIODevice::ReadOnly);
|
||||
if (pythonProc.waitForFinished() && (pythonProc.exitCode() == 0)) {
|
||||
executable = "python2";
|
||||
return executable;
|
||||
}
|
||||
#endif
|
||||
// Look for "python" in Windows and in UNIX if "python2" and "python3" are
|
||||
// not detected.
|
||||
|
||||
Reference in New Issue
Block a user