Browse Source

Merge pull request #5842 from yezezey/macOSpython

Set /usr/local/bin before default PATH on macOS. Closes #5639 #5571
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
aa1e884c81
  1. 11
      src/app/main.cpp
  2. 3
      src/gui/mainwindow.cpp

11
src/app/main.cpp

@ -230,6 +230,17 @@ int main(int argc, char *argv[])
qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1)); qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
#endif #endif
#if defined(Q_OS_MAC)
{
// Since Apple made difficult for users to set PATH, we set here for convenience.
// Users are supposed to install Homebrew Python for search function.
// For more info see issue #5571.
QByteArray path = "/usr/local/bin:";
path += qgetenv("PATH");
qputenv("PATH", path.constData());
}
#endif
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
if (!upgrade()) return EXIT_FAILURE; if (!upgrade()) return EXIT_FAILURE;
#else #else

3
src/gui/mainwindow.cpp

@ -1476,7 +1476,8 @@ void MainWindow::on_actionSearchWidget_triggered()
// Check if python is already in PATH // Check if python is already in PATH
if (pythonVersion > 0) if (pythonVersion > 0)
Logger::instance()->addMessage(tr("Python found in %1").arg("PATH"), Log::INFO); // Prevent translators from messing with PATH // Prevent translators from messing with PATH
Logger::instance()->addMessage(tr("Python found in %1: %2", "Python found in PATH: /usr/local/bin:/usr/bin:/etc/bin").arg("PATH").arg(qgetenv("PATH").constData()), Log::INFO);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
else if (addPythonPathToEnv()) else if (addPythonPathToEnv())
pythonVersion = Utils::Misc::pythonVersion(); pythonVersion = Utils::Misc::pythonVersion();

Loading…
Cancel
Save