mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
46
python/mach/mach/base.py
Normal file
46
python/mach/mach/base.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
|
||||
class CommandContext(object):
|
||||
"""Holds run-time state so it can easily be passed to command providers."""
|
||||
def __init__(self, cwd=None, settings=None, log_manager=None,
|
||||
commands=None, **kwargs):
|
||||
self.cwd = cwd
|
||||
self.settings = settings
|
||||
self.log_manager = log_manager
|
||||
self.commands = commands
|
||||
|
||||
for k,v in kwargs.items():
|
||||
setattr(self, k, v)
|
||||
|
||||
|
||||
class MachError(Exception):
|
||||
"""Base class for all errors raised by mach itself."""
|
||||
|
||||
|
||||
class NoCommandError(MachError):
|
||||
"""No command was passed into mach."""
|
||||
|
||||
|
||||
class UnknownCommandError(MachError):
|
||||
"""Raised when we attempted to execute an unknown command."""
|
||||
|
||||
def __init__(self, command, verb, suggested_commands=None):
|
||||
MachError.__init__(self)
|
||||
|
||||
self.command = command
|
||||
self.verb = verb
|
||||
self.suggested_commands = suggested_commands or []
|
||||
|
||||
class UnrecognizedArgumentError(MachError):
|
||||
"""Raised when an unknown argument is passed to mach."""
|
||||
|
||||
def __init__(self, command, arguments):
|
||||
MachError.__init__(self)
|
||||
|
||||
self.command = command
|
||||
self.arguments = arguments
|
||||
Loading…
Add table
Add a link
Reference in a new issue