Browse Source

Fix python version detection

Closes #9146.
adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
2528c6e39a
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 8
      src/base/utils/foreignapps.cpp

8
src/base/utils/foreignapps.cpp

@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
#include <QCoreApplication>
#include <QProcess>
#include <QRegularExpression>
#include <QStringList>
#include "base/logger.h"
@ -56,8 +57,13 @@ namespace @@ -56,8 +57,13 @@ namespace
if (outputSplit.size() <= 1)
return false;
// User reports: `python --version` -> "Python 3.6.6+"
// So trim off unrelated characters
const QString versionStr = outputSplit[1];
const int idx = versionStr.indexOf(QRegularExpression("[^\\.\\d]"));
try {
info = {exeName, outputSplit[1]};
info = {exeName, versionStr.left(idx)};
}
catch (const std::runtime_error &err) {
return false;

Loading…
Cancel
Save