("1.0-r1", "1.0"),
("999999999999999999999999999999", "999999999999999999999999999998"),
("1.0.0", "1.0"),
- ("12.2.5", "12.2b"),
+ ("1.0b", "1.0.0"),
+ ("12.2b", "12.2.5"),
]
for test in tests:
self.failIf( vercmp( test[0], test[1] ) <= 0, msg="%s < %s? Wrong!" % (test[0],test[1]) )
("1.0-r0", "1.0-r1"),
("1.0", "1.0-r1"),
("1.0", "1.0.0"),
- ("12.2b", "12.2.5"),
+ ("1.0.0", "1.0b"),
+ ("12.2.5", "12.2b"),
]
for test in tests:
self.failIf( vercmp( test[0], test[1]) >= 0, msg="%s > %s? Wrong!" % (test[0],test[1]))
if len(match1.group(3)) or len(match2.group(3)):
vlist1 = match1.group(3)[1:].split(".")
vlist2 = match2.group(3)[1:].split(".")
+
+ # and now the final letter
+ if match1.group(5):
+ vlist1.append(str(ord(match1.group(5))))
+ else:
+ vlist1.append('0')
+ if match2.group(5):
+ vlist2.append(str(ord(match2.group(5))))
+ else:
+ vlist2.append('0')
+
for i in range(0, max(len(vlist1), len(vlist2))):
# Implcit .0 is given a value of -1, so that 1.0.0 > 1.0, since it
# would be ambiguous if two versions that aren't literally equal
list1.append(int(vlist1[i].ljust(max_len, "0")))
list2.append(int(vlist2[i].ljust(max_len, "0")))
- # and now the final letter
- if len(match1.group(5)):
- list1.append(ord(match1.group(5)))
- if len(match2.group(5)):
- list2.append(ord(match2.group(5)))
-
for i in range(0, max(len(list1), len(list2))):
if len(list1) <= i:
vercmp_cache[mykey] = -1