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 09e94ae4ac

Change-Id: I92214474f581af228bd5c2aaf2f3e4b620ffc9d5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-12-01 06:51:07 +01:00
parent 21c078773f
commit c0a3565362
3 changed files with 13 additions and 0 deletions

View File

@@ -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()) {

View File

@@ -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,

View File

@@ -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)