eric6/Globals/__init__.py

changeset 7641
21ea4fd50b0a
parent 7639
422fd05e9c91
child 7673
f0309b9483b1
--- a/eric6/Globals/__init__.py	Fri Jul 03 17:37:11 2020 +0200
+++ b/eric6/Globals/__init__.py	Sat Jul 04 11:34:37 2020 +0200
@@ -351,7 +351,7 @@
 ###############################################################################
 
 
-def versionToTuple(version):
+def versionToTuple(version, length=3):
     """
     Module function to convert a version string into a tuple.
     
@@ -361,6 +361,8 @@
     
     @param version version string
     @type str
+    @param length desired length of the version tuple
+    @type int
     @return version tuple without the suffix
     @rtype tuple of int
     """
@@ -370,8 +372,9 @@
     version = re.split(r"[^\d.]", version)[0]
     for part in version.split("."):
         versionParts.append(int(part))
+    versionParts.extend([0] * length)
     
-    return tuple(versionParts)
+    return tuple(versionParts[:length])
 
 
 def qVersionTuple():

eric ide

mercurial