update usage of python indexer to call run.py

This commit is contained in:
mlangkabel
2021-01-25 20:43:00 +01:00
parent ecfa1b7920
commit 197e127035
5 changed files with 34 additions and 17 deletions
+12 -2
View File
@@ -37,12 +37,22 @@ FilePath ResourcePaths::getJavaPath()
return AppPath::getSharedDataPath().concatenate(L"data/java/"); return AppPath::getSharedDataPath().concatenate(L"data/java/");
} }
FilePath ResourcePaths::getPythonPath() FilePath ResourcePaths::getPythonEnvironmentFilePath()
{ {
return AppPath::getSharedDataPath().concatenate(L"data/python/"); return ResourcePaths::getPythonPath().concatenate(L"environment/Scripts/python");
}
FilePath ResourcePaths::getPythonIndexerFilePath()
{
return ResourcePaths::getPythonPath().concatenate(L"indexer/run.py");
} }
FilePath ResourcePaths::getCxxCompilerHeaderPath() FilePath ResourcePaths::getCxxCompilerHeaderPath()
{ {
return AppPath::getSharedDataPath().concatenate(L"data/cxx/include/").getCanonical(); return AppPath::getSharedDataPath().concatenate(L"data/cxx/include/").getCanonical();
} }
FilePath ResourcePaths::getPythonPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/python/");
}
+5 -1
View File
@@ -15,8 +15,12 @@ public:
static FilePath getGuiPath(); static FilePath getGuiPath();
static FilePath getLicensePath(); static FilePath getLicensePath();
static FilePath getJavaPath(); static FilePath getJavaPath();
static FilePath getPythonPath(); static FilePath getPythonEnvironmentFilePath();
static FilePath getPythonIndexerFilePath();
static FilePath getCxxCompilerHeaderPath(); static FilePath getCxxCompilerHeaderPath();
private:
static FilePath getPythonPath();
}; };
#endif // RESOURCE_PATHS_H #endif // RESOURCE_PATHS_H
@@ -24,13 +24,13 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
{ {
std::string pythonIndexerVersion = " "; std::string pythonIndexerVersion = " ";
{ {
std::string str = std::string str = utility::executeProcess(
utility::executeProcess( ResourcePaths::getPythonEnvironmentFilePath().wstr(),
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"), std::vector<std::wstring> {
{L"--version"}, ResourcePaths::getPythonIndexerFilePath().wstr(), L"--version"},
FilePath(), FilePath(),
5000) 5000)
.second; .second;
std::regex regex( std::regex regex(
"v\\d*\\.db\\d*\\.p\\d*"); // "\\d" matches any digit; "\\." matches the "." character "v\\d*\\.db\\d*\\.p\\d*"); // "\\d" matches any digit; "\\." matches the "." character
std::smatch matches; std::smatch matches;
@@ -63,12 +63,14 @@ void QtProjectWizardContentPathPythonEnvironment::onTextChanged(const QString& t
m_resultLabel->setText("Checking validity of Python environment..."); m_resultLabel->setText("Checking validity of Python environment...");
std::thread([=]() { std::thread([=]() {
std::pair<int, std::string> out = utility::executeProcess( std::pair<int, std::string> out = utility::executeProcess(
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"), ResourcePaths::getPythonEnvironmentFilePath().wstr(),
{L"check-environment", std::vector<std::wstring> {
L"--environment-path " + ResourcePaths::getPythonIndexerFilePath().wstr(),
utility::getExpandedAndAbsolutePath( L"check-environment",
FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath()) L"--environment-path " +
.wstr()}, utility::getExpandedAndAbsolutePath(
FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath())
.wstr()},
FilePath(), FilePath(),
5000); 5000);
m_onQtThread([=]() { m_onQtThread([=]() {
@@ -79,7 +79,8 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerC
{ {
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>( indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
INDEXER_COMMAND_PYTHON, INDEXER_COMMAND_PYTHON,
L"\"" + ResourcePaths::getPythonPath().wstr() + L"SourcetrailPythonIndexer\"", L"\"" + ResourcePaths::getPythonEnvironmentFilePath().wstr() + L"\" \"" +
ResourcePaths::getPythonIndexerFilePath().wstr() + L"\"",
args, args,
m_settings->getProjectSettings()->getProjectFilePath(), m_settings->getProjectSettings()->getProjectFilePath(),
m_settings->getProjectSettings()->getTempDBFilePath(), m_settings->getProjectSettings()->getTempDBFilePath(),