diff --git a/scripts/imgtool/version.py b/scripts/imgtool/version.py index 6e38f445..b803834a 100644 --- a/scripts/imgtool/version.py +++ b/scripts/imgtool/version.py @@ -1,4 +1,5 @@ # Copyright 2017 Linaro Limited +# Copyright 2024 Arm Limited # # SPDX-License-Identifier: Apache-2.0 # @@ -20,9 +21,9 @@ Semi Semantic Versioning Implements a subset of semantic versioning that is supportable by the image header. """ - -from collections import namedtuple import re +import sys +from collections import namedtuple SemiSemVersion = namedtuple('SemiSemVersion', ['major', 'minor', 'revision', 'build']) @@ -49,7 +50,7 @@ def decode_version(text): if __name__ == '__main__': - print(decode_version("1.2")) - print(decode_version("1.0")) - print(decode_version("0.0.2+75")) - print(decode_version("0.0.0+00")) + if len(sys.argv) > 1: + print(decode_version(sys.argv[1])) + else: + print("Requires an argument, e.g. '1.0.0'")