Skip to content

Commit

Permalink
manifest: Add a new optiona description field
Browse files Browse the repository at this point in the history
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
  • Loading branch information
carlescufi committed Aug 31, 2023
1 parent 0ecaf92 commit 69f8619
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/west/manifest-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ mapping:
name:
required: true
type: str
# Project description. Has no effect.
description:
required: false
type: str
# Name of the project's remote. May not be combined with "url".
remote:
required: false
Expand Down
18 changes: 14 additions & 4 deletions src/west/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}, '
Expand All @@ -776,7 +778,7 @@ def __str__(self):
path_repr = repr(self.abspath or self.path)
return f'<Project {self.name} ({path_repr}) at {self.revision}>'

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,
Expand All @@ -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*
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit 69f8619

Please sign in to comment.