policycoreutils/sepolicy: Define our own cmp()

Fixes:
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/sepolicy/gui.py", line 1447, in stripsort
    return cmp(val1, val2)
NameError: name 'cmp' is not defined

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
This commit is contained in:
Petr Lautrbach 2017-05-03 12:30:31 +02:00 committed by Stephen Smalley
parent d9c2a15831
commit 4a7de9ffdc

View File

@ -69,8 +69,14 @@ enabled = [_("No"), _("Yes")]
action = [_("Disable"), _("Enable")]
def compare(a, b):
return cmp(a.lower(), b.lower())
def cmp(a, b):
if a is None and b is None:
return 0
if a is None:
return -1
if b is None:
return 1
return (a > b) - (a < b)
import distutils.sysconfig
ADVANCED_LABEL = (_("Advanced >>"), _("Advanced <<"))