From 8ebcfd254084aa1c45a658a86e1008be277c09ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Wed, 18 Jan 2023 20:58:01 +0100 Subject: [PATCH] [zap] Fix version check (#24487) zap_execution.py would fail when the minimum version was 2023.1.9 and installed was 2023.1.17. Signed-off-by: Damian Krolik Signed-off-by: Damian Krolik --- scripts/tools/zap/zap_execution.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index a5eefe157c16a3..cd88d07158c240 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -18,9 +18,7 @@ import sys from typing import Tuple -# The version MUST be of the form `YYYY.MM.YY' -# Since this is ordered as such, alphabetical sorting will be used to check -# validity +# The version MUST be of the form `YYYY.M.D' # # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions @@ -97,7 +95,10 @@ def version_check(self, min_version=None): print('*'*80) sys.exit(1) - if version < MIN_ZAP_VERSION: + def parse_version_string(str): + return list(map(lambda component: int(component), str.split('.'))) + + if parse_version_string(version) < parse_version_string(MIN_ZAP_VERSION): print(f"Checking ZAP from {self.zap_start}:") print( f" !!! Version validation failed: required at least {MIN_ZAP_VERSION}, got {version} instead")