[MERGE] Re: windows-only problem with launchpad plugin

Lukáš Lalinský lalinsky at gmail.com
Tue Jul 10 21:34:02 BST 2007


On Ut, 2007-07-10 at 23:15 +0300, Alexander Belchenko wrote: 
> This fix is somewhat wrong:
> 
> @@ -253,13 +257,8 @@
>              continue
> 
>          try:
> - -            plugin = ziobj.load_module(plugin_name)
> - -            setattr(plugins, plugin_name, plugin)
> +            exec "import bzrlib.plugins.%s" % plugin_name in {}
> 
> ^-- "import bzrlib.plugins.%s" is wrong.
> As I wrote in my another message, function load_from_zip() is designed to be general zipimporter
> rather than only for bzrlib.plugins. If you want to use such ad-hoc, it's need to change the overall
> codepath of importing built-in plugins by checking is bzr running as python script, or as standalone
> bzr.exe.

But this behavior is different from load_from_dir, which I think makes
it wrong. The point is that plugins need to be able to import another
plugins before they are explicitly loaded by bzr. For this reason,
bzrlib.plugins.__path__ is set, before the plugins are loaded. So there
is no reason to import the zip file manually, because Python will take
care of it itself.

> In latter case all that stuff with prefix and searching of names in zip-archive has very little
> sense, because we know most of the info apriori.

But this might change, or you might want to bundle another plugins in
the Windows installer, etc. I think it's safer to keep it there.

> Also this hardcoded path does break selftest: bzrlib.tests.test_plugins.TestPluginFromZip is failed.

Sorry about this, I missed the failed test. I think the test is wrong
and inconsistent with changes introduced in bzr.dev at 2258. I'll update it
in my next patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Toto je =?ISO-8859-1?Q?digit=E1lne?=
	=?ISO-8859-1?Q?_podp=EDsan=E1?= =?UTF-8?Q?_=C4=8Das=C5=A5?=
	=?ISO-8859-1?Q?_spr=E1vy?=
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070710/bfdc8d21/attachment-0001.pgp 


More information about the bazaar mailing list