mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
Rolled back original compare code
This commit is contained in:
parent
e0bdf0e079
commit
24da38415e
1 changed files with 3 additions and 14 deletions
|
@ -85,20 +85,9 @@ class UpdateLabel(QtGui.QLabel):
|
||||||
|
|
||||||
|
|
||||||
def compare_versions(self, version1, version2):
|
def compare_versions(self, version1, version2):
|
||||||
parts1 = [int(x) for x in version1.split('.')]
|
def normalize(v):
|
||||||
parts2 = [int(x) for x in version2.split('.')]
|
return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")]
|
||||||
|
return cmp(normalize(version1), normalize(version2))
|
||||||
# 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 ignore_this_version(self):
|
def ignore_this_version(self):
|
||||||
self.setText("")
|
self.setText("")
|
||||||
|
|
Loading…
Add table
Reference in a new issue