Fix a bug in comparing versions

This commit is contained in:
Mike Gerber 2015-05-24 23:53:29 +02:00
parent 134f4f5fd9
commit 90b2ee1423
2 changed files with 19 additions and 2 deletions

View file

@ -39,12 +39,17 @@ class Version(object):
return str_ > str_other
for self_c, other_c in zip(self.components(), other.components()):
if num_gt(self_c, other_c):
return True
if self_c == other_c:
continue
else:
return num_gt(self_c, other_c)
return False
# Note: not using functools.total_ordering to support Python 2.6
def __lt__(self, other):
return not (self == other) and not (self > other)
def proc_version():
v = open('/proc/version', 'r')