[MERGE] Command Not Found core code
jw+debian at jameswestby.net
Mon Mar 3 18:59:43 GMT 2008
On Mon, 2008-03-03 at 17:15 +0000, Martin Albisetti wrote:
> Since I'm still not sure on what to do with the plugin database bit,
> I'm attaching just the code needed in the core to make this spec work,
> and I'll send a separate merge request with the plugin itself so it
> can be discussed independently.
> With this code merged, I can also make a plugin available so people
> can start playing around with it easier.
I'm glad to see this work moving forwards.
> + # look for plugins that provide this command but aren't
> + for provider in command_providers_registry:
> + try:
> + plugin_metadata = provider.plugin_for_command(cmd_name)
> + except errors.NoPluginAvailable:
> + pass
> + else:
> + raise errors.CommandAvailableInPlugin(cmd_name,
> plugin_metadata, provider)
a python2.5ism? I thought I read something the other day that said it
was. I don't have 2.4 installed to check though I'm afraid.
I'm not familiar with registries, is there some sort of ordering
involved? I'm assuming the apt plugin will add an entry in this
registry, and then want to be preferred if it has the particular plugin.
How does a method change the message that is printed if it has the
plugin in question? The apt one will want to tell the user apt-get
install, rather than a URL to find it.
Also, I think we want some sort of fallback, for instance the apt
method can only install system wide, so if the user doesn't have root
we want to say
apt-get install bzr-svn
bzr checkout wherever ~/.bazaar/plugins/
so that both are covered.
This may just be a first pass ignoring these issues, and if that is the
case then please feel free to disregard these comments.
More information about the bazaar