Skip to content

Commit

Permalink
[ros2doctor] Handle non-metapackages in rosdistro check (#452)
Browse files Browse the repository at this point in the history
Otherwise, we get a KeyError and get warnings about not being able to find versions for certain packages.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron authored Feb 19, 2020
1 parent a7541b9 commit 1038758
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ros2doctor/ros2doctor/api/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ def get_distro_package_versions() -> dict:
doctor_warn('No repository information found.')
return
distro_package_vers = {}
for _, info in repos_info.items():
for package_name, info in repos_info.items():
try:
release = info['release']
packages = release['packages']
ver = release.get('version')
for p in packages:
distro_package_vers[p] = ver
if 'packages' in release:
# Metapackage
for package in release['packages']:
distro_package_vers[package] = ver
else:
distro_package_vers[package_name] = ver
except KeyError:
pass
return distro_package_vers
Expand Down

0 comments on commit 1038758

Please sign in to comment.