New version_tuple function in gen_misc.py
Also, set global values for use by others:
- python_version
- ordered_dict_version
Change-Id: Ibc0324105206214155766f5d092b5c5385fc9eb8
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_misc.py b/lib/gen_misc.py
index 9631182..b24b57d 100755
--- a/lib/gen_misc.py
+++ b/lib/gen_misc.py
@@ -612,3 +612,19 @@
username = "?"
return username
+
+
+def version_tuple(version):
+ r"""
+ Convert the version string to a tuple and return it.
+
+ Description of argument(s):
+ version A version string whose format is "n[.n]"
+ (e.g. "3.6.3", "3", etc.).
+ """
+
+ return tuple(map(int, (version.split("."))))
+
+
+python_version = version_tuple(sys.version.replace("\n", "").split(" ")[0])
+ordered_dict_version = version_tuple("3.6")