From aadb84432077807b61b9bb2254a02c21748ce031 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 31 Aug 2023 15:30:16 +0200 Subject: [PATCH] manifest: Add a new optiona description field Signed-off-by: Carles Cufi --- src/west/manifest-schema.yml | 4 ++++ src/west/manifest.py | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/west/manifest-schema.yml b/src/west/manifest-schema.yml index b964ef9c..dd2552f6 100644 --- a/src/west/manifest-schema.yml +++ b/src/west/manifest-schema.yml @@ -82,6 +82,10 @@ mapping: name: required: true type: str + # Project description. + description: + required: false + type: str # Name of the project's remote. May not be combined with "url". remote: required: false diff --git a/src/west/manifest.py b/src/west/manifest.py index 43727acd..fb6c6699 100644 --- a/src/west/manifest.py +++ b/src/west/manifest.py @@ -53,7 +53,7 @@ #: v1.0.x, so that users can say "I want schema version 1" instead of #: having to keep using '0.13', which was the previous version this #: changed.) -SCHEMA_VERSION = '1.0' +SCHEMA_VERSION = '1.2' # MAINTAINERS: # # - Make sure to update _VALID_SCHEMA_VERS if you change this. @@ -195,7 +195,7 @@ class _defaults(NamedTuple): _EARLIEST_VER_STR = '0.6.99' # we introduced the version feature after 0.6 _VALID_SCHEMA_VERS = [ _EARLIEST_VER_STR, - '0.7', '0.8', '0.9', '0.10', '0.12', '0.13', + '0.7', '0.8', '0.9', '0.10', '0.12', '0.13', '1.0', SCHEMA_VERSION ] @@ -734,6 +734,7 @@ class Project: Attributes: - ``name``: project's unique name + - ``description``: project's description - ``url``: project fetch URL - ``revision``: revision to fetch from ``url`` when the project is updated @@ -765,6 +766,7 @@ def __eq__(self, other): def __repr__(self): return (f'Project("{self.name}", "{self.url}", ' + f'"{self.description}", ' f'revision="{self.revision}", path={repr(self.path)}, ' f'clone_depth={self.clone_depth}, ' f'west_commands={self.west_commands}, ' @@ -776,7 +778,7 @@ def __str__(self): path_repr = repr(self.abspath or self.path) return f'' - def __init__(self, name: str, url: str, + def __init__(self, name: str, description: Optional[str], url: str, revision: Optional[str] = None, path: Optional[PathType] = None, submodules: SubmodulesType = False, @@ -792,6 +794,7 @@ def __init__(self, name: str, url: str, (``abspath`` and ``posixpath``) will also be ``None``. :param name: project's ``name:`` attribute in the manifest + :param description: project's description or None :param url: fetch URL :param revision: fetch revision :param path: path (relative to topdir), or None for *name* @@ -808,6 +811,7 @@ def __init__(self, name: str, url: str, ''' self.name = name + self.description = description self.url = url self.submodules = submodules self.revision = revision or _DEFAULT_REV @@ -849,12 +853,17 @@ def posixpath(self) -> Optional[str]: def name_and_path(self) -> str: return f'{self.name} ({self.path})' + @property + def description(self) -> Optional[str]: + return self.description + def as_dict(self) -> Dict: '''Return a representation of this object as a dict, as it would be parsed from an equivalent YAML manifest. ''' ret: Dict = {} ret['name'] = self.name + ret['description'] = self.description ret['url'] = self.url ret['revision'] = self.revision if self.path != self.name: @@ -2276,6 +2285,7 @@ def _load_project(self, pd: Dict, url_bases: Dict[str, str], # manifest) name = pd['name'] + description = pd.get('description') # The name "manifest" cannot be used as a project name; it # is reserved to refer to the manifest repository itself @@ -2351,7 +2361,7 @@ def _load_project(self, pd: Dict, url_bases: Dict[str, str], userdata = pd.get('userdata') - ret = Project(name, url, pd.get('revision', defaults.revision), path, + ret = Project(name, description, url, pd.get('revision', defaults.revision), path, submodules=self._load_submodules(pd.get('submodules'), f'project {name}'), clone_depth=pd.get('clone-depth'),