b.plugin : module documentation

Part of bzrlib

bzr python plugin support.

When load_plugins() is invoked, any python module in any directory in $BZR_PLUGIN_PATH will be imported. The module will be imported as 'bzrlib.plugins.$BASENAME(PLUGIN)'. In the plugin's main body, it should update any bzrlib registries it wants to extend.

See the plugin-api developer documentation for information about writing plugins.

BZR_PLUGIN_PATH is also honoured for any plugins imported via 'import bzrlib.plugins.PLUGINNAME', as long as set_plugins_path has been called.

Function are_plugins_disabled Undocumented
Function disable_plugins Disable loading plugins.
Function describe_plugins Generate text description of plugins.
Function set_plugins_path Set the path for plugins to be loaded from.
Function get_core_plugin_path Undocumented
Function get_site_plugin_path Returns the path for the site installed plugins.
Function get_user_plugin_path Undocumented
Function get_standard_plugins_path Determine a plugin path suitable for general use.
Function load_plugins Load bzrlib plugins.
Function load_from_path Load bzrlib plugins found in each dir in dirs.
Function record_plugin_warning Undocumented
Function load_from_dir Load the plugins in directory d.
Function plugins Return a dictionary of the plugins.
Function format_concise_plugin_list Return a string holding a concise list of plugins and their version.
Class PluginsHelpIndex A help index that returns help topics for plugins.
Class ModuleHelpTopic A help topic which returns the docstring for a module.
Class PlugIn The bzrlib representation of a plugin.
Function _strip_trailing_sep Undocumented
Function _get_specific_plugin_paths Returns the plugin paths from a string describing the associations.
Function _append_new_path Append a new path if it set and not already known.
Function _find_plugin_module Check if there is a valid python module that can be loaded as a plugin.
Function _load_plugin_module Load plugin name from dir.
Class _PluginImporter An importer tailored to bzr specific needs.
def are_plugins_disabled():
Undocumented
def disable_plugins():
Disable loading plugins.

Future calls to load_plugins() will be ignored.

def describe_plugins(show_paths=False):
Generate text description of plugins.

Includes both those that have loaded, and those that failed to load.

Parametersshow_pathsIf true,
ReturnsIterator of text lines (including newlines.)
def _strip_trailing_sep(path):
Undocumented
def _get_specific_plugin_paths(paths):
Returns the plugin paths from a string describing the associations.

For example, if paths is my_plugin@/test/my-test:her_plugin@/production/her, [('my_plugin', '/test/my-test'), ('her_plugin', '/production/her')] will be returned.

Note that ':' in the example above depends on the os.

ParameterspathsA string describing the paths associated with the plugins.
ReturnsA list of (plugin name, path) tuples.
def set_plugins_path(path=None):
Set the path for plugins to be loaded from.
ParameterspathThe list of paths to search for plugins. By default, path will be determined using get_standard_plugins_path. if path is [], no plugins can be loaded.
def _append_new_path(paths, new_path):
Append a new path if it set and not already known.
def get_core_plugin_path():
Undocumented
def get_site_plugin_path():
Returns the path for the site installed plugins.
def get_user_plugin_path():
Undocumented
def get_standard_plugins_path():
Determine a plugin path suitable for general use.
def load_plugins(path=None):
Load bzrlib plugins.

The environment variable BZR_PLUGIN_PATH is considered a delimited set of paths to look through. Each entry is searched for *.py files (and whatever other extensions are used in the platform, such as *.pyd).

load_from_path() provides the underlying mechanism and is called with the default directory list to provide the normal behaviour.

ParameterspathThe list of paths to search for plugins. By default, path will be determined using get_standard_plugins_path. if path is [], no plugins can be loaded.
def load_from_path(dirs):
Load bzrlib plugins found in each dir in dirs.

Loading a plugin means importing it into the python interpreter. The plugin is expected to make calls to register commands when it's loaded (or perhaps access other hooks in future.)

Plugins are loaded into bzrlib.plugins.NAME, and can be found there for future reference.

The python module path for bzrlib.plugins will be modified to be 'dirs'.

def _find_plugin_module(dir, name):
Check if there is a valid python module that can be loaded as a plugin.
ParametersdirThe directory where the search is performed.
pathAn existing file path, either a python file or a package directory.
Returns(name, path, description) name is the module name, path is the file to load and description is the tuple returned by imp.get_suffixes().
def record_plugin_warning(plugin_name, warning_message):
Undocumented
def _load_plugin_module(name, dir):
Load plugin name from dir.
ParametersnameThe plugin name in the bzrlib.plugins namespace.
dirThe directory the plugin is loaded from for error messages.
def load_from_dir(d):
Load the plugins in directory d.

d must be in the plugins module path already. This function is called once for each directory in the module path.

def plugins():
Return a dictionary of the plugins.

Each item in the dictionary is a PlugIn object.

def format_concise_plugin_list():
Return a string holding a concise list of plugins and their version.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.