author Christian Holler <>
Tue, 22 Jan 2013 16:48:02 +0100
changeset 125574 08c14f94fbb73b64f0338d8332fa28e0b26e0856
parent 117042 4f96fdb5e4f9b9e101e2e3c5f535bff8e0fe8f6c
child 132648 c9bf19d37fe084efd285fb985784a0d92a02f978
permissions -rw-r--r--
Bug 833018 - Enable special ASan options for tests when running with low memory. r=jmaher,a=nonlibxul

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

from __future__ import unicode_literals

import collections

class MachRegistrar(object):
    """Container for mach command and config providers."""

    def __init__(self):
        self.command_handlers = {}
        self.settings_providers = set()

    def register_command_handler(self, handler):
        name = handler.parser_args[0][0]

        self.command_handlers[name] = handler

    def register_settings_provider(self, cls):

    def populate_argument_parser(self, parser):
        for command in sorted(self.command_handlers.keys()):
            handler = self.command_handlers[command]
            p = parser.add_parser(*handler.parser_args[0],

            for arg in handler.arguments:
                p.add_argument(*arg[0], **arg[1])

            p.set_defaults(mach_class=handler.cls, mach_method=handler.method,

Registrar = MachRegistrar()