[RFC] bzr help plugin-name
John Arbash Meinel
john at arbash-meinel.com
Tue Jun 20 04:09:23 BST 2006
Martin Pool wrote:
> On 20 Jun 2006, Robert Collins <robertc at robertcollins.net> wrote:
>> On Mon, 2006-06-19 at 10:37 -0500, John Arbash Meinel wrote:
>>> Robert Collins wrote:
>>>> I think it would be nice if 'bzr help <pluginname>' were to show the
>>>> docstring from the plugin. This would allow plugins that introduce a
>>>> number of commands to have a single place to give conceptual guidance
>>>> and help - one that users can be taught how to predict.
>>>>
>>>> Rob
>>> This goes back into having plugins export a 'canonical' name. Otherwise
>>> I may work like mpe and have 01_shelf, or bzrtools-baz2bzr, or
>>> bzrtools-lifeless, etc.
>
> I can see there are cases such as yourself it's useful but I do think
> it's a bit of an advanced use, and I think for most instances people
> should just call the directory by its canonical name.
>
> Would it be enough for those modules to do something like (pseudocode)
>
> sys.modules['bzrlib.plugins.guisupport'] == __module__
>
> ?
True. Well, true if they use:
sys.modules['bzrlib.plugins.guisupport'] = __module__
('=' not '==')
But also isn't that hard to do:
plugin = imp.load_module('bzrlib.plugins.' + name,
*plugin_info)
setattr(bzrlib.plugins, name, plugin)
canonical_name = getattr(plugin, 'canonical_name', None)
if canonical_name and canonical_name != name:
sys.modules['bzrlib.plugins.' + canonical_name] = plugin
setattr(bzrlib.plugins, canonical_name, plugin)
But I guess just using 'sys.modules' would be enough for plugins that
really care to put themselves somewhere where others can get at them.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060619/56743a4e/attachment.pgp
More information about the bazaar
mailing list