示例#1
0
def load_bundled_plugin(plugin_name):
    """Load a plugin bundled with Bazaar."""
    from bzrlib.plugin import get_core_plugin_path
    from bzrlib import plugins
    if get_core_plugin_path() not in plugins.__path__:
        plugins.__path__.append(get_core_plugin_path())
    __import__("bzrlib.plugins.%s" % plugin_name)
    def setUp(self):
        super(TestEnvPluginPath, self).setUp()
        self.overrideAttr(plugin, 'DEFAULT_PLUGIN_PATH', None)

        self.user = plugin.get_user_plugin_path()
        self.site = plugin.get_site_plugin_path()
        self.core = plugin.get_core_plugin_path()
示例#3
0
    def setUp(self):
        super(TestEnvPluginPath, self).setUp()
        self.overrideAttr(plugin, 'DEFAULT_PLUGIN_PATH', None)

        self.user = plugin.get_user_plugin_path()
        self.site = plugin.get_site_plugin_path()
        self.core = plugin.get_core_plugin_path()
示例#4
0
def _command_helps(exporter, plugin_name=None):
    """Extract docstrings from path.

    This respects the Bazaar cmdtable/table convention and will
    only extract docstrings from functions mentioned in these tables.
    """
    from glob import glob

    # builtin commands
    for cmd_name in _mod_commands.builtin_command_names():
        command = _mod_commands.get_cmd_object(cmd_name, False)
        if command.hidden:
            continue
        if plugin_name is not None:
            # only export builtins if we are not exporting plugin commands
            continue
        note(gettext("Exporting messages from builtin command: %s"), cmd_name)
        _write_command_help(exporter, command)

    plugin_path = plugin.get_core_plugin_path()
    core_plugins = glob(plugin_path + '/*/__init__.py')
    core_plugins = [os.path.basename(os.path.dirname(p)) for p in core_plugins]
    # plugins
    for cmd_name in _mod_commands.plugin_command_names():
        command = _mod_commands.get_cmd_object(cmd_name, False)
        if command.hidden:
            continue
        if plugin_name is not None and command.plugin_name() != plugin_name:
            # if we are exporting plugin commands, skip plugins we have not specified.
            continue
        if plugin_name is None and command.plugin_name() not in core_plugins:
            # skip non-core plugins
            # TODO: Support extracting from third party plugins.
            continue
        note(
            gettext(
                "Exporting messages from plugin command: {0} in {1}").format(
                    cmd_name, command.plugin_name()))
        _write_command_help(exporter, command)
示例#5
0
def _command_helps(exporter, plugin_name=None):
    """Extract docstrings from path.

    This respects the Bazaar cmdtable/table convention and will
    only extract docstrings from functions mentioned in these tables.
    """
    from glob import glob

    # builtin commands
    for cmd_name in _mod_commands.builtin_command_names():
        command = _mod_commands.get_cmd_object(cmd_name, False)
        if command.hidden:
            continue
        if plugin_name is not None:
            # only export builtins if we are not exporting plugin commands
            continue
        note(gettext("Exporting messages from builtin command: %s"), cmd_name)
        _write_command_help(exporter, command)

    plugin_path = plugin.get_core_plugin_path()
    core_plugins = glob(plugin_path + '/*/__init__.py')
    core_plugins = [os.path.basename(os.path.dirname(p))
                        for p in core_plugins]
    # plugins
    for cmd_name in _mod_commands.plugin_command_names():
        command = _mod_commands.get_cmd_object(cmd_name, False)
        if command.hidden:
            continue
        if plugin_name is not None and command.plugin_name() != plugin_name:
            # if we are exporting plugin commands, skip plugins we have not specified.
            continue
        if plugin_name is None and command.plugin_name() not in core_plugins:
            # skip non-core plugins
            # TODO: Support extracting from third party plugins.
            continue
        note(gettext("Exporting messages from plugin command: {0} in {1}").format(
             cmd_name, command.plugin_name() ))
        _write_command_help(exporter, command)