1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 11:22:41 +01:00

utils/types: Add version_tuple

Allow for `version_tuple` to be used more generically to enable
natural comparing of versions encoded as strings.
This commit is contained in:
Marc Bonnici
2019-06-28 11:58:41 +01:00
committed by setrofim
parent 8910234448
commit f46851a3b4
4 changed files with 12 additions and 8 deletions

View File

@@ -208,6 +208,13 @@ def regex(value):
return re.compile(value)
def version_tuple(v):
"""
Converts a version string into a tuple of ints that can be used for natural comparison.
"""
return tuple(map(int, (v.split("."))))
__counters = defaultdict(int)