]> jfr.im git - erebus.git/commitdiff
fix genhelp - py3 doesnt support __cmp__
authorJohn Runyon <redacted>
Thu, 15 Jun 2023 01:09:33 +0000 (19:09 -0600)
committerJohn Runyon <redacted>
Thu, 15 Jun 2023 01:09:33 +0000 (19:09 -0600)
modules/help.py

index 9c66731ea286136320333c6942145393e66de7aa..6774fe4c4446e9784b570965fc6d165dec74c78c 100644 (file)
@@ -24,6 +24,7 @@ def modstart(parent, *args, **kwargs):
 modstop = lib.modstop
 
 # module code
+import functools
 import os.path
 helps = {}
 cmds  = {}
@@ -63,6 +64,7 @@ def dereghelp(func, *args, **kwargs):
                del cmds[c]
        del helps[func]
 
+@functools.total_ordering
 class HelpLine(object):
        def __init__(self, cmd, syntax, shorthelp, admin, glevel, module, clevel):
                self.cmd = cmd
@@ -73,6 +75,15 @@ class HelpLine(object):
                self.module = module
                self.clevel = clevel
 
+       def __lt__(self, other):
+               if self.glevel == other.glevel:
+                       return self.cmd < other.cmd
+               else:
+                       return self.glevel < other.glevel
+
+       def __eq__(self, other):
+               return self.glevel == other.glevel and self.cmd == other.cmd
+
        def __cmp__(self, other):
                if self.glevel == other.glevel:
                        return cmp(self.cmd, other.cmd)