diff options
author | Brian May <brian@linuxpenguins.xyz> | 2019-03-06 17:02:04 +1100 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-07-29 10:20:41 +0200 |
commit | 95dbfd508136a166c12d9e05bbb7f94c800ff5f7 (patch) | |
tree | 3123ca1da73b082c71df9c5e43d876f6cccd5beb /lib/python | |
parent | c28b352d4bef70f734f809fec8be5c5d60ba856e (diff) |
Add comparison functions required for Python3
Diffstat (limited to 'lib/python')
-rw-r--r-- | lib/python/debian_support.py | 25 |
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 |