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

Lukáš Lalinský lalinsky at gmail.com
Tue Jul 10 22:17:19 BST 2007

On Ut, 2007-07-10 at 16:11 -0400, Aaron Bentley wrote:
> -    if '.zip' not in zip_name:
> +
> +    try:
> +        index = zip_name.rindex('.zip')
> +    except ValueError:
>          return
> ^^^ I think the assignment of prefix should be moved up here.  It's not
> obvious that we use index later on.


> - -            plugin = ziobj.load_module(plugin_name)
> - -            setattr(plugins, plugin_name, plugin)
> +            exec "import bzrlib.plugins.%s" % plugin_name in {}
> Why do we want to use exec "import" here?

I used exec just for consistency with load_from_dir. There was some
discussion on the mailing list
<http://thread.gmane.org/gmane.comp.version-control.bazaar-ng.general/21831/focus=21852> and it was decided to use exec.

On St, 2007-07-11 at 00:01 +0300, Alexander Belchenko wrote:
> > 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.
> No, I don't think so.
> In the case of bzr.exe all python libraries is placed in one library.zip,
> and this zip present in sys.path. That's why import from zip works transparently
> for bzr.exe.
> So, for importing built-in plugins you don't need to change default __path__,
> just append additional directories to default plugins.__path__. I think function
> set_plugins_path() is slightly incorrect here.

Right, but you can add plugin locations also via BZR_PLUGIN_PATH, which
can point to a zip file. From this point of view, there is no
difference between built-in plugins and plugins from custom
zip files.

>> 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.
> No, bzr.dev pass these tests.

I meant logically wrong.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr-zipimport.diff
Type: text/x-patch
Size: 7915 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070710/102a051b/attachment.bin 
-------------- 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?=
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070710/102a051b/attachment.pgp 

More information about the bazaar mailing list