[PATCH] Plugins, yet again

John A Meinel john at arbash-meinel.com
Thu Jun 16 19:35:04 BST 2005


Alright, so I've modified the plugin code according to all of the
current advice.

There is now a new section for parsing what I am calling "master"
options, but might also be thought of as "global" options. Basically,
options that affect all commands, or are parsed before the command is given.

Specifically, I mean the new:
    bzr --no-plugins <command>
    bzr --builtin <command>

And the original:
    bzr --help
    bzr --version

(I would like to see bzr version be a standard command, just for
unification sake).

And what I think should be used:
    bzr --profile <command>

The new code uses imp.get_suffixes() to be a little bit more platform
independent about what suffixes it allows (though it has to carefully
handle the testmodule.so versus test.so problem, and manually hard-code
.pyo as a valid extension).
It also will load packages.

It uses ~/.bzr/plugins as a default plugin directory. This should
actually be a different directory on Windows. (Specifically it should
probably be $APPDATA/Bazaar-NG/plugins or something else in a more
'official' windows location. But that applies to ~/.bzr.log, and all the
future .bzr configuration stuff.

bzr --builtin now still loads the plugins, and lets non-existing
commands still be run, but plugins will not override builtin commands.
bzr --no-plugins completely disables plugin loading.
The only other thing that may need to be done is properly inform the
"help" system of the --builtin flag. Right now bzr --builtin <command>
will run the builtin, but "bzr --builtin help <command>" will give the
plugin info. (The easy alternative is just to switch this so that "bzr
help <command>" always returns the built-in help).

The attached patch is against bzr-mainline revision 691, so it doesn't
require any other patches to be supplied.

Also, stuff like "BZR_PLUGIN_PATH='' bzr help" also disables loading any
plugins.

With this patch, if you want a default startup script, just plop it into
~/.bzr/plugins. And you don't have to do anything to the environment.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: plugins-no-plugins.patch
Type: text/x-patch
Size: 19057 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050616/1d89acb6/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050616/1d89acb6/attachment.pgp 


More information about the bazaar mailing list