From 59eee9191f0a34296a398bd6804e41ebf7822c72 Mon Sep 17 00:00:00 2001 From: Brian May Date: Wed, 6 Mar 2019 17:02:04 +1100 Subject: Add comparison functions required for Python3 --- lib/python/debian_support.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib') 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 -- cgit v1.2.3