Rolled back original compare code

This commit is contained in:
Maran 2013-01-16 14:45:07 +01:00
parent e0bdf0e079
commit 24da38415e
1 changed files with 3 additions and 14 deletions

View File

@ -85,20 +85,9 @@ class UpdateLabel(QtGui.QLabel):
def compare_versions(self, version1, version2):
parts1 = [int(x) for x in version1.split('.')]
parts2 = [int(x) for x in version2.split('.')]
# fill up the shorter version with zeros ...
lendiff = len(parts1) - len(parts2)
if lendiff > 0:
parts2.extend([0] * lendiff)
elif lendiff < 0:
parts1.extend([0] * (-lendiff))
for i, p in enumerate(parts1):
ret = cmp(p, parts2[i])
if ret: return ret
return 0
def normalize(v):
return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")]
return cmp(normalize(version1), normalize(version2))
def ignore_this_version(self):
self.setText("")