ipaplatform.redhat: Use bytestrings when calling rpm.so for version comparison
Part of the work for: https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
1 parent
9ca450ac43
commit
743828b0f4
1 file changed
+6
-2
@@ -84,13 +84,17 @@ class IPAVersion(object):
|
||||
def __init__(self, version):
|
||||
self.version = version
|
||||
|
||||
@property
|
||||
def _bytes(self):
|
||||
return self.version.encode('utf-8')
|
||||
|
||||
def __eq__(self, other):
|
||||
assert isinstance(other, IPAVersion)
|
||||
return _librpm.rpmvercmp(self.version, other.version) == 0
|
||||
return _librpm.rpmvercmp(self._bytes, other._bytes) == 0
|
||||
|
||||
def __lt__(self, other):
|
||||
assert isinstance(other, IPAVersion)
|
||||
return _librpm.rpmvercmp(self.version, other.version) < 0
|
||||
return _librpm.rpmvercmp(self._bytes, other._bytes) < 0
|
||||
|
||||
|
||||
class RedHatTaskNamespace(BaseTaskNamespace):
|
||||
|
||||
Reference in new issue
Block a user