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/");
}
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()
{
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 getLicensePath();
static FilePath getJavaPath();
static FilePath getPythonPath();
static FilePath getPythonEnvironmentFilePath();
static FilePath getPythonIndexerFilePath();
static FilePath getCxxCompilerHeaderPath();
private:
static FilePath getPythonPath();
};
#endif // RESOURCE_PATHS_H
@@ -24,13 +24,13 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
{
std::string pythonIndexerVersion = " ";
{
std::string str =
utility::executeProcess(
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"),
{L"--version"},
FilePath(),
5000)
.second;
std::string str = utility::executeProcess(
ResourcePaths::getPythonEnvironmentFilePath().wstr(),
std::vector<std::wstring> {
ResourcePaths::getPythonIndexerFilePath().wstr(), L"--version"},
FilePath(),
5000)
.second;
std::regex regex(
"v\\d*\\.db\\d*\\.p\\d*"); // "\\d" matches any digit; "\\." matches the "." character
std::smatch matches;
@@ -63,12 +63,14 @@ void QtProjectWizardContentPathPythonEnvironment::onTextChanged(const QString& t
m_resultLabel->setText("Checking validity of Python environment...");
std::thread([=]() {
std::pair<int, std::string> out = utility::executeProcess(
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"),
{L"check-environment",
L"--environment-path " +
utility::getExpandedAndAbsolutePath(
FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath())
.wstr()},
ResourcePaths::getPythonEnvironmentFilePath().wstr(),
std::vector<std::wstring> {
ResourcePaths::getPythonIndexerFilePath().wstr(),
L"check-environment",
L"--environment-path " +
utility::getExpandedAndAbsolutePath(
FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath())
.wstr()},
FilePath(),
5000);
m_onQtThread([=]() {
@@ -79,7 +79,8 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerC
{
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
INDEXER_COMMAND_PYTHON,
L"\"" + ResourcePaths::getPythonPath().wstr() + L"SourcetrailPythonIndexer\"",
L"\"" + ResourcePaths::getPythonEnvironmentFilePath().wstr() + L"\" \"" +
ResourcePaths::getPythonIndexerFilePath().wstr() + L"\"",
args,
m_settings->getProjectSettings()->getProjectFilePath(),
m_settings->getProjectSettings()->getTempDBFilePath(),