manifest: Add submodule representation in as_dict

Submodules were missing when calling --freeze or --resolve

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-09-20 14:34:23 +02:00 committed by Marc Herbert
parent 08d0329131
commit 0da3de16eb
1 changed files with 10 additions and 1 deletions

View File

@ -882,6 +882,15 @@ class Project:
_west_commands_maybe_delist(self.west_commands) _west_commands_maybe_delist(self.west_commands)
if self.groups: if self.groups:
ret['groups'] = self.groups ret['groups'] = self.groups
if isinstance(self.submodules, bool) and self.submodules:
ret['submodules'] = True
elif isinstance(self.submodules, list):
ret['submodules'] = []
for s in self.submodules:
obj: Dict = {'path': s.path}
if s.name:
obj['name'] = s.name
ret['submodules'].append(obj)
if self.userdata: if self.userdata:
ret['userdata'] = self.userdata ret['userdata'] = self.userdata
@ -1143,7 +1152,7 @@ class ManifestProject(Project):
# Pretending that this is a Project, even though it's not (#327) # Pretending that this is a Project, even though it's not (#327)
self.description: Optional[str] = None self.description: Optional[str] = None
self.url: str = '' self.url: str = ''
self.submodules = False self.submodules: SubmodulesType = False
self.revision: str = 'HEAD' self.revision: str = 'HEAD'
self.remote_name: str = '' self.remote_name: str = ''
self.clone_depth: Optional[int] = None self.clone_depth: Optional[int] = None