Skip to content

Commit 533fef2

Browse files
rustammendeldavidvincze
authored andcommitted
imgtool: Update version.py to take command line arguments
Main method printed hardcoded versions, update to take argument to enable the possibility of testing version strings by invoking the command through command line. Signed-off-by: Rustam Ismayilov <[email protected]> Change-Id: If75769ef223944865313ed95336e859ebef85fd6
1 parent 316a139 commit 533fef2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: scripts/imgtool/version.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright 2017 Linaro Limited
2+
# Copyright 2024 Arm Limited
23
#
34
# SPDX-License-Identifier: Apache-2.0
45
#
@@ -20,9 +21,9 @@
2021
Implements a subset of semantic versioning that is supportable by the image
2122
header.
2223
"""
23-
24-
from collections import namedtuple
2524
import re
25+
import sys
26+
from collections import namedtuple
2627

2728
SemiSemVersion = namedtuple('SemiSemVersion', ['major', 'minor', 'revision',
2829
'build'])
@@ -49,7 +50,7 @@ def decode_version(text):
4950

5051

5152
if __name__ == '__main__':
52-
print(decode_version("1.2"))
53-
print(decode_version("1.0"))
54-
print(decode_version("0.0.2+75"))
55-
print(decode_version("0.0.0+00"))
53+
if len(sys.argv) > 1:
54+
print(decode_version(sys.argv[1]))
55+
else:
56+
print("Requires an argument, e.g. '1.0.0'")

0 commit comments

Comments
 (0)