From c0a35653622a6e48ecfa790224a144e2a3df1900 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 1 Dec 2023 06:51:07 +0100 Subject: [PATCH] Python: Create a default BuildSystem for Python targets This makes sure the project can be parsed even if we do not have a valid build configuration for that target. Amends 09e94ae4ac040ad313b7b86e62489dee7cd3804a Change-Id: I92214474f581af228bd5c2aaf2f3e4b620ffc9d5 Reviewed-by: Christian Stenger --- src/plugins/python/pythonbuildsystem.cpp | 10 ++++++++++ src/plugins/python/pythonbuildsystem.h | 1 + src/plugins/python/pythonproject.cpp | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/plugins/python/pythonbuildsystem.cpp b/src/plugins/python/pythonbuildsystem.cpp index e46e33497bc..717395e6aa4 100644 --- a/src/plugins/python/pythonbuildsystem.cpp +++ b/src/plugins/python/pythonbuildsystem.cpp @@ -129,6 +129,16 @@ PythonBuildSystem::PythonBuildSystem(PythonBuildConfiguration *buildConfig) requestParse(); } +PythonBuildSystem::PythonBuildSystem(ProjectExplorer::Target *target) + : BuildSystem(target) +{ + connect(project(), + &Project::projectFileIsDirty, + this, + &PythonBuildSystem::requestDelayedParse); + requestParse(); +} + bool PythonBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const { if (node->asFileNode()) { diff --git a/src/plugins/python/pythonbuildsystem.h b/src/plugins/python/pythonbuildsystem.h index 9729ac3fe50..adf69640790 100644 --- a/src/plugins/python/pythonbuildsystem.h +++ b/src/plugins/python/pythonbuildsystem.h @@ -13,6 +13,7 @@ class PythonBuildSystem : public ProjectExplorer::BuildSystem { public: explicit PythonBuildSystem(PythonBuildConfiguration *buildConfig); + explicit PythonBuildSystem(ProjectExplorer::Target *target); bool supportsAction(ProjectExplorer::Node *context, ProjectExplorer::ProjectAction action, diff --git a/src/plugins/python/pythonproject.cpp b/src/plugins/python/pythonproject.cpp index 316e35d2620..02eafcbcff3 100644 --- a/src/plugins/python/pythonproject.cpp +++ b/src/plugins/python/pythonproject.cpp @@ -23,6 +23,8 @@ PythonProject::PythonProject(const FilePath &fileName) setId(PythonProjectId); setProjectLanguages(Context(ProjectExplorer::Constants::PYTHON_LANGUAGE_ID)); setDisplayName(fileName.completeBaseName()); + + setBuildSystemCreator([](Target *t) { return new PythonBuildSystem(t); }); } Project::RestoreResult PythonProject::fromMap(const Store &map, QString *errorMessage)