Skip to content

Commit

Permalink
imgtool: Update version.py to take command line arguments
Browse files Browse the repository at this point in the history
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 <rustam.ismayilov@arm.com>
Change-Id: If75769ef223944865313ed95336e859ebef85fd6
  • Loading branch information
rustammendel authored and davidvincze committed Jun 14, 2024
1 parent 316a139 commit 533fef2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/imgtool/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2017 Linaro Limited
# Copyright 2024 Arm Limited
#
# SPDX-License-Identifier: Apache-2.0
#
Expand All @@ -20,9 +21,9 @@
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'])
Expand All @@ -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'")

0 comments on commit 533fef2

Please sign in to comment.