windows-only problem with launchpad plugin
Alexander Belchenko
bialix at ukr.net
Tue Jul 10 15:58:52 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool пишет:
> https://bugs.launchpad.net/bugs/124899
>
> There seems to be something strange happening with the registration of
> the lp: plugin on Windows. I can't reproduce it in 0.19dev on Ubuntu.
> Could anyone investigate this and see if they can reproduce it or
> diagnose it? I wonder if the plugin code is interacting badly with
> the way things are packaged into a zip on windows.
This problem occurs only with standalone bzr.exe.
As I can see, error raised because launchpad plugin's body (__init__.py)
imported and executed twice: first time during searching
plugins, and second time when transport for 'lp:' scheme
lazy loads bzrlib.plugins.launchpad.lp_indirect module.
Typically, Python interpreter cache all modules during import,
so body of module executed only at first import. All subsequent imports
use cached module object.
It seems that zipimport does not cache imported module,
or cache with different name.
I set BZR_PDB=1 and reproduce problem, then I examine sys.modules.
And I see in particular such modules:
'launchpad',
'launchpad.bzrlib',
'bzrlib.plugins.launchpad.bzrlib'
But no 'bzrlib.plugins.launchpad' module.
I think it's the root of problem.
So, to fix this bug we should fix bzrlib/plugin.py:load_from_zip() function.
This function designed to be universal enough to import plugin from *any* arbitrary
zip-archive. Probably we should restrict functionality to import *only* from
zip-archive with bzrlib, i.e. for built-in plugins under bzrlib/plugins path.
Otherwise, this function should check what kind of zip-archive is under way,
and for archive with bzrlib either switch to another code path, or manually
put imported module in sys.modules with name like bzrlib.plugins.launchpad.
In any case bugfix seems not very hard, but I don't know how to write corresponding
test for this problem.
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGk56szYr338mxwCURAts3AJ9N5ptoSz+/cuvsFYH8pCDwcN1PhgCfXWv9
er2FgB9HPavF8rvv+/nTPzg=
=PBEa
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list