build: Fixed macOS bundle not using correct Python environment

* Pass verbose flag to Python indexer if enabled
This commit is contained in:
Eberhard Graether
2019-05-15 14:44:49 +02:00
parent a9887da9f1
commit b5e8c7f452
3 changed files with 25 additions and 3 deletions
@@ -231,7 +231,7 @@ void TaskExecuteCustomCommands::runIndexerCommand(std::shared_ptr<IndexerCommand
}
else
{
message += L"with message \"" + processOutput + L"\".";
message += L" with message \"" + processOutput + L"\".";
}
message += L"\n";
LOG_INFO(message);
@@ -305,7 +305,7 @@ void TaskExecuteCustomCommands::runPythonPostProcessing(PersistentStorage& stora
}
const std::wstring token = utility::decodeFromUtf8(textAccess->getLine(startLoc->getLineNumber()).substr(startLoc->getColumnNumber() - 1, endLoc->getColumnNumber() - startLoc->getColumnNumber() + 1));
for (const Id tokenId : startLoc->getTokenIds())
{
const StorageEdge edge = storage.getEdgeById(tokenId);
@@ -313,7 +313,7 @@ void TaskExecuteCustomCommands::runPythonPostProcessing(PersistentStorage& stora
{
for (const StorageNode& targetNode : nodeNameToStorageNodes[token])
{
if (Edge::intToType(edge.type) == Edge::EDGE_CALL &&
if (Edge::intToType(edge.type) == Edge::EDGE_CALL &&
(
NodeType::intToType(targetNode.type) != NodeType::NODE_FUNCTION ||
NodeType::intToType(targetNode.type) != NodeType::NODE_METHOD
+16
View File
@@ -4,6 +4,7 @@
#include <QSysInfo>
#include <QThread>
#include <qprocessordetection.h>
#include <QRegularExpression>
#include "License.h"
#include "ApplicationSettings.h"
@@ -28,6 +29,11 @@ std::string utility::executeProcess(const std::string& command, const FilePath&
process.setWorkingDirectory(QString::fromStdWString(workingDirectory.wstr()));
}
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QStringList envlist = env.toStringList();
envlist.replaceInStrings(QRegularExpression("^(?i)PATH=(.*)"), "PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1");
process.setEnvironment(envlist);
{
std::lock_guard<std::mutex> lock(s_runningProcessesMutex);
process.start(command.c_str());
@@ -59,6 +65,11 @@ std::string utility::executeProcessUntilNoOutput(const std::string& command, con
process.setWorkingDirectory(QString::fromStdWString(workingDirectory.wstr()));
}
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QStringList envlist = env.toStringList();
envlist.replaceInStrings(QRegularExpression("^(?i)PATH=(.*)"), "PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1");
process.setEnvironment(envlist);
{
std::lock_guard<std::mutex> lock(s_runningProcessesMutex);
process.start(command.c_str());
@@ -141,6 +152,11 @@ int utility::executeProcessAndGetExitCode(
command += " " + QString::fromStdWString(commandArgument);
}
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QStringList envlist = env.toStringList();
envlist.replaceInStrings(QRegularExpression("^(?i)PATH=(.*)"), "PATH=/opt/local/bin:/usr/local/bin:$HOME/bin:\\1");
process.setEnvironment(envlist);
{
std::lock_guard<std::mutex> lock(s_runningProcessesMutex);
process.start(command);
@@ -1,5 +1,6 @@
#include "SourceGroupPythonEmpty.h"
#include "ApplicationSettings.h"
#include "FileManager.h"
#include "IndexerCommandCustom.h"
#include "ProjectSettings.h"
@@ -51,6 +52,11 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerC
args += L" --environment-directory-path=" + m_settings->getEnvironmentDirectoryPathExpandedAndAbsolute().wstr();
}
if (ApplicationSettings::getInstance()->getVerboseIndexerLoggingEnabled())
{
args += L" --verbose";
}
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
for (const FilePath& sourceFilePath : getAllSourceFilePaths())
{