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

Alexander Belchenko bialix at ukr.net
Tue Jul 10 22:01:55 BST 2007


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

Lukáš Lalinský пишет:
> 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. 

This difference intriduced by Robert, when he switch to use plugins.__path__ in
revno.2256.2.3

> 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.

> 
>> 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.

No, bzr.dev pass these tests.

- --
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGk/PDzYr338mxwCURAq6zAJ0Umhetj7phMRcKEOmw3AbIdvRbqACeMA/N
3jvIy2TyLX9oHVSD6gzLyLY=
=Hp9N
-----END PGP SIGNATURE-----



More information about the bazaar mailing list