summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian May <brian@linuxpenguins.xyz>2019-03-06 17:02:04 +1100
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-07-29 10:20:41 +0200
commit59eee9191f0a34296a398bd6804e41ebf7822c72 (patch)
treeebd52d1668f0283a29c85161c6048bd2657ad3bb /lib
parent4337fae9faa283c8e473ee14ced2528292d48a12 (diff)
Add comparison functions required for Python3
Diffstat (limited to 'lib')
-rw-r--r--lib/python/debian_support.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py
index 65caf95554..95d55d8ac1 100644
--- a/lib/python/debian_support.py
+++ b/lib/python/debian_support.py
@@ -116,6 +116,21 @@ class Version:
except AttributeError:
return apt_pkg.VersionCompare(self.__forCompare, other.__forCompare)
+ def __lt__(self, other):
+ return self.__cmp__(other) < 0
+
+ def __le__(self, other):
+ return self.__cmp__(other) <= 0
+
+ def __eq__(self, other):
+ return self.__cmp__(other) == 0
+
+ def __gt__(self, other):
+ return self.__cmp__(other) > 0
+
+ def __ge__(self, other):
+ return self.__cmp__(other) >= 0
+
def version_compare(a, b):
"""Compares two versions according to the Debian algorithm.
@@ -211,6 +226,16 @@ class PseudoEnum:
return cmp(self._order, other._order)
def __hash__(self):
return hash(self._order)
+ def __lt__(self, other):
+ return self._order < other._order
+ def __le__(self, other):
+ return self._order <= other._order
+ def __eq__(self, other):
+ return self._order == other._order
+ def __gt__(self, other):
+ return self._order > other._order
+ def __ge__(self, other):
+ return self._order >= other._order
class Release(PseudoEnum): pass

© 2014-2024 Faster IT GmbH | imprint | privacy policy