mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
committed by
Martin Basti
parent
9ca450ac43
commit
743828b0f4
@@ -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