Skip to content

Commit

Permalink
fix: Parsing of west.yml when determining NCS version
Browse files Browse the repository at this point in the history
  • Loading branch information
TjazVracko committed Oct 3, 2024
1 parent 5542e64 commit 0c4ec15
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Fixed

- Parsing of `west.yml` when a project within the yaml does not contain the `repo-path` key.

## [0.23.0] - 2024-09-24

### Added
Expand Down
17 changes: 11 additions & 6 deletions src/east/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,23 @@ def get_ncs_and_project_dir(west_dir_path: str) -> Tuple[str, str]:
with open(west_yaml, "r") as file:
manifest = yaml.safe_load(file)["manifest"]

try:
ncs = list(
filter(
lambda project: project["repo-path"] == "sdk-nrf", manifest["projects"]
lambda project: project.get("repo-path", "") == "sdk-nrf",
manifest["projects"],
)
)
except KeyError:
# This can happen in the case where there is no sdk-nrf repo in the west yaml
# file, project is probably using ordinary Zephyr.

# This can happen in the case where there is no sdk-nrf repo in the west yaml
# file, project is probably using ordinary Zephyr.
if len(ncs) == 0:
return None, project_path

return (ncs[0]["revision"], project_path)
# Attempt to extract the NCS revision, which is optional.
# (We can safely access the first element, since we checked the length above)
revision = ncs[0].get("revision", None)

return (revision, project_path)


def return_dict_on_match(array_of_dicts, key, value):
Expand Down

0 comments on commit 0c4ec15

Please sign in to comment.