From 5c5dade631a8eda59eecf19e12365f22e240bace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Fri, 7 Jun 2024 21:47:08 +0200 Subject: [PATCH] Audit: Avoid error on wrong version name --- github_app_geo_project/module/audit/utils.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/github_app_geo_project/module/audit/utils.py b/github_app_geo_project/module/audit/utils.py index 34191b01b59..cb39a1d500a 100644 --- a/github_app_geo_project/module/audit/utils.py +++ b/github_app_geo_project/module/audit/utils.py @@ -401,11 +401,19 @@ def _get_sources( ) for package in _SOURCES[dist].packages: name = f"{dist}/{package.package}" - version = debian_inspector.version.Version.from_string(package.version) - if name not in _PACKAGE_VERSION: - _PACKAGE_VERSION[name] = version - elif version > _PACKAGE_VERSION[name]: - _PACKAGE_VERSION[name] = version + try: + version = debian_inspector.version.Version.from_string(package.version) + if name not in _PACKAGE_VERSION: + _PACKAGE_VERSION[name] = version + elif version > _PACKAGE_VERSION[name]: + _PACKAGE_VERSION[name] = version + except ValueError as exception: + _LOGGER.warning( + "Error while parsing the package %s version of %s: %s", + package.package, + package.version, + exception, + ) return _SOURCES[dist]