mirror of
https://github.com/servo/servo.git
synced 2025-07-20 13:53:42 +01:00
Cargoify servo
This commit is contained in:
parent
db2f642c32
commit
c6ab60dbfc
1761 changed files with 8423 additions and 2294 deletions
0
python/mach/mach/commands/__init__.py
Normal file
0
python/mach/mach/commands/__init__.py
Normal file
41
python/mach/mach/commands/commandinfo.py
Normal file
41
python/mach/mach/commands/commandinfo.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# 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 print_function, unicode_literals
|
||||
|
||||
from mach.decorators import (
|
||||
CommandProvider,
|
||||
Command,
|
||||
)
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class BuiltinCommands(object):
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
@Command('mach-commands', category='misc',
|
||||
description='List all mach commands.')
|
||||
def commands(self):
|
||||
print("\n".join(self.context.commands.command_handlers.keys()))
|
||||
|
||||
@Command('mach-debug-commands', category='misc',
|
||||
description='Show info about available mach commands.')
|
||||
def debug_commands(self):
|
||||
import inspect
|
||||
|
||||
handlers = self.context.commands.command_handlers
|
||||
for command in sorted(handlers.keys()):
|
||||
handler = handlers[command]
|
||||
cls = handler.cls
|
||||
method = getattr(cls, getattr(handler, 'method'))
|
||||
|
||||
print(command)
|
||||
print('=' * len(command))
|
||||
print('')
|
||||
print('File: %s' % inspect.getsourcefile(method))
|
||||
print('Class: %s' % cls.__name__)
|
||||
print('Method: %s' % handler.method)
|
||||
print('')
|
||||
|
50
python/mach/mach/commands/settings.py
Normal file
50
python/mach/mach/commands/settings.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
# 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 print_function, unicode_literals
|
||||
|
||||
from textwrap import TextWrapper
|
||||
|
||||
from mach.decorators import (
|
||||
CommandProvider,
|
||||
Command,
|
||||
)
|
||||
|
||||
|
||||
#@CommandProvider
|
||||
class Settings(object):
|
||||
"""Interact with settings for mach.
|
||||
|
||||
Currently, we only provide functionality to view what settings are
|
||||
available. In the future, this module will be used to modify settings, help
|
||||
people create configs via a wizard, etc.
|
||||
"""
|
||||
def __init__(self, context):
|
||||
self.settings = context.settings
|
||||
|
||||
@Command('settings-list', category='devenv',
|
||||
description='Show available config settings.')
|
||||
def list_settings(self):
|
||||
"""List available settings in a concise list."""
|
||||
for section in sorted(self.settings):
|
||||
for option in sorted(self.settings[section]):
|
||||
short, full = self.settings.option_help(section, option)
|
||||
print('%s.%s -- %s' % (section, option, short))
|
||||
|
||||
@Command('settings-create', category='devenv',
|
||||
description='Print a new settings file with usage info.')
|
||||
def create(self):
|
||||
"""Create an empty settings file with full documentation."""
|
||||
wrapper = TextWrapper(initial_indent='# ', subsequent_indent='# ')
|
||||
|
||||
for section in sorted(self.settings):
|
||||
print('[%s]' % section)
|
||||
print('')
|
||||
|
||||
for option in sorted(self.settings[section]):
|
||||
short, full = self.settings.option_help(section, option)
|
||||
|
||||
print(wrapper.fill(full))
|
||||
print(';%s =' % option)
|
||||
print('')
|
Loading…
Add table
Add a link
Reference in a new issue