Python plugins, third round
Martin Pool
mbp at sourcefrog.net
Thu Jun 16 06:27:10 BST 2005
On 15 Jun 2005, John A Meinel <john at arbash-meinel.com> wrote:
> When you are saying packages, do you mean:
> mypackage/__init__.py ?
> That is much easier to do (and more reasonable) than doing the single
> directory recursion. Since python imports that as "mypackage".
>
> So it is pretty easy to alter my code to support everything of the form:
>
> ~/.bzr/plugins/
> plugin.py
> plugin.pyc
> plugin.pyo
> pluginmodule.so
> plugin.so
> plugin.pyd
> plugin.dll
> plugin.dylib
> plugin/__init__.py
>
> All of those would be loaded from:
> sys.path.append(os.path.expanduser('~/.bzr/plugins'))
> import plugin
I assume here you're using 'plugin' as a variable; not requiring it to
be called plugin. You probably want imp.get_suffixes() not a
hardcoded list.
I'm kind of surprised there isn't a standard module to do this...
> The way the current code works is that "builtin" is actually a command,
> not an option. So you have:
> bzr builtin commit --something
I think this one is good; it's similar to the shell and some other
languages and adheres to the pattern that options can be moved around but
arguments/commands cannot.
> You could also require "--builtin" to be the first option. So it would
> always be
> bzr --builtin commit --something.
I'd also like --no-plugins, which would disable them altogether, and
sometimes be a better choice than 'bzr builtin'.
--
Martin
More information about the bazaar
mailing list