summaryrefslogtreecommitdiff
path: root/src/mailman/bin/mailman.py
diff options
context:
space:
mode:
authorBarry Warsaw2015-01-04 20:20:33 -0500
committerBarry Warsaw2015-01-04 20:20:33 -0500
commit4a612db8e89afed74173b93f3b64fa567b8417a3 (patch)
tree81a687d113079a25f93279f35c7eee2aa2572510 /src/mailman/bin/mailman.py
parent84af79988a4e916604cba31843778206efb7d1b8 (diff)
parentde181c1a40965a3a7deedd56a034a946f45b6984 (diff)
downloadmailman-4a612db8e89afed74173b93f3b64fa567b8417a3.tar.gz
mailman-4a612db8e89afed74173b93f3b64fa567b8417a3.tar.zst
mailman-4a612db8e89afed74173b93f3b64fa567b8417a3.zip
Diffstat (limited to 'src/mailman/bin/mailman.py')
-rw-r--r--src/mailman/bin/mailman.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mailman/bin/mailman.py b/src/mailman/bin/mailman.py
index 67f4d0910..ad8de144f 100644
--- a/src/mailman/bin/mailman.py
+++ b/src/mailman/bin/mailman.py
@@ -17,9 +17,6 @@
"""The 'mailman' command dispatcher."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'main',
]
@@ -28,13 +25,13 @@ __all__ = [
import os
import argparse
-from zope.interface.verify import verifyObject
-
+from functools import cmp_to_key
from mailman.core.i18n import _
from mailman.core.initialize import initialize
from mailman.interfaces.command import ICLISubCommand
from mailman.utilities.modules import find_components
from mailman.version import MAILMAN_VERSION_FULL
+from zope.interface.verify import verifyObject
@@ -77,9 +74,14 @@ def main():
return -1
elif other.name == 'help':
return 1
+ elif command.name < other.name:
+ return -1
+ elif command.name == other.name:
+ return 0
else:
- return cmp(command.name, other.name)
- subcommands.sort(cmp=sort_function)
+ assert command.name > other.name
+ return 1
+ subcommands.sort(key=cmp_to_key(sort_function))
for command in subcommands:
command_parser = subparser.add_parser(
command.name, help=_(command.__doc__))