[MERGE] Command Not Found core code

John Arbash Meinel john at arbash-meinel.com
Mon Mar 3 21:56:53 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Albisetti wrote:
> On Mon, Mar 3, 2008 at 6:59 PM, James Westby <jw+debian at jameswestby.net> wrote:
>>  > +    # look for plugins that provide this command but aren't
>>  > installed
>>  > +    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)
>>  >
>>
>>  Is
>>
>>   try:
>>     ...
>>   except:
>>     ...
>>   else:
>>     ...
>>
>>  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.
> 
> Seems right, I'll fix this for python 2.4 compatibility.
> 

try:
except:
else:

should be fine, it is:
try:
except:
finally:

that is in 2.5.

John
=:->
> 
>>  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.
> 
> Each provider will add an entry to this, and the last one will always
> be de "default" one, which would be checkouts.
> This last bit of automatically pushing the default as the last
> possible provider is still absent as the "more than one" provider is
> still a bit out of scope. I hope to get that nailed down during the
> sprint and continue work on that (that would include the default
> checkout installer, which is half-way coded).
> 
> 
>>  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.
> 
> Actually, the message in the end will be the same:
> "X command is not currently available, but a plugin does provide it.
> Run: 'bzr install-plugin X' to install it" (or something similar).
> 
> So the "install-plugin" command would try the current registered
> providers in order and finally fall back to checkouts if none
> othercould provide it.
> This way, whatever each distro installs by default will be the
> preferred one, but the user will still be able to get it if it's not
> packaged.
> 
> 
>>  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
>>    OR
>>    bzr checkout wherever ~/.bazaar/plugins/
> 
> That's exactly the idea  :D
> 
> 
>>  This may just be a first pass ignoring these issues, and if that is the
>>  case then please feel free to disregard these comments.
> 
> Not at all. Any comments are welcome, and probably more so during this
> week that I can dedicate 24/7 to it.
> 
> Thanks,
> 
> 
> Martin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHzHNBJdeBCYSNAAMRAoApAKDQIQzJtOQ2R9qCq77f38gIGSDXXwCgutis
0Ii0nb5PwTvJ2SCfrGJazSM=
=FDE4
-----END PGP SIGNATURE-----



More information about the bazaar mailing list