Python plugins, third round
John A Meinel
john at arbash-meinel.com
Thu Jun 16 06:48:26 BST 2005
Martin Pool wrote:
>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 only one that "imp.get_suffixes()" doesn't list is the
plugin/__init__.py form, but I agree, we might as well use what python
provides. (and technically dir/__init__.py is still a .py form)
>>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'.
>
>
>
So are you thinking that:
bzr builtin command <= run the built-in form of command, but still load
plugins
bzr --no-plugins command <= don't load any plugins
I was thinking that builtin would *not* load any plugins, not just not
disable the cmd functions.
Being that way, though, I'm fine with just having the "--no-plugins"
option, since it is pretty obvious what it is doing.
John
=:->
-------------- 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/7d50c2e7/attachment.pgp
More information about the bazaar
mailing list