diff options
| -rw-r--r-- | setup.py | 10 | ||||
| -rw-r--r-- | src/mailman/app/commands.py | 17 |
2 files changed, 14 insertions, 13 deletions
@@ -65,13 +65,6 @@ scripts = set( for script in mailman.bin.__all__ ) -# Default email commands -template = Template('$command = mailman.commands.$command') -commands = set( - template.substitute(command=command) - for command in mailman.commands.__all__ - ) - setup( @@ -92,8 +85,7 @@ case second `m'. Any other spelling is incorrect.""", package_dir = {'': 'src'}, include_package_data = True, entry_points = { - 'console_scripts': list(scripts), - 'mailman.commands' : list(commands), + 'console_scripts' : list(scripts), 'mailman.handlers' : 'default = mailman.pipeline:initialize', 'mailman.rules' : 'default = mailman.rules:initialize', 'mailman.scrubber' : 'stock = mailman.archiving.pipermail:Pipermail', diff --git a/src/mailman/app/commands.py b/src/mailman/app/commands.py index d7676af9c..cd4513629 100644 --- a/src/mailman/app/commands.py +++ b/src/mailman/app/commands.py @@ -25,18 +25,27 @@ __all__ = [ ] +import sys + +from mailman import commands from mailman.config import config -from mailman.core.plugins import get_plugins from mailman.interfaces.command import IEmailCommand def initialize(): """Initialize the email commands.""" - for module in get_plugins('mailman.commands'): - for name in module.__all__: + for command_module in commands.__all__: + module_name = 'mailman.commands.' + command_module + __import__(module_name) + module = sys.modules[module_name] + for name in dir(module): command_class = getattr(module, name) - if not IEmailCommand.implementedBy(command_class): + try: + is_command = IEmailCommand.implementedBy(command_class) + except TypeError: + is_command = False + if not is_command: continue assert command_class.name not in config.commands, ( 'Duplicate email command "{0}" found in {1}'.format( |
