[BUG][MERGE] 'bzr upgrade' broken by lazy imports

Wouter van Heyst larstiq at larstiq.dyndns.org
Wed Nov 8 14:57:38 GMT 2006


On Tue, Nov 07, 2006 at 12:18:45PM -0600, John Arbash Meinel wrote:
> Howdy all, someone else managed to track down a missing import dependency:
> https://launchpad.net/bugs/70716
> 
> I fixed this specific dependency with the attached patch. I'd like to
> get it merged quickly. Also, we need to decide if it is worth releasing
> an 0.12.1. It is a regression, though the simple workaround is to just
> install bzrtools (which imports bzrlib.workingtree as part of it's startup).

+1, alson on the 0.12.1 front.

> I chose to fix this by doing 'from bzrlib.workingtree import Foo' rather
> than changing the global imports, because that is how all the other
> local functions work. And probably that is because of an import
> dependency issue. One nice thing about lazy imports is that they solve
> some import order issues, since you won't import something until it is used.
> 
> I'll go ahead and spend some time auditing our code base, trying to
> avoid these things in the future. I'd like to get more lazy importing
> (and future Registry based importing of some of the different format
> classes we have). So it will be good to track through these things.
> 
> My initial feeling is to just change most code paths that use
> 'bzrilb.foo' to being 'from bzrlib import foo' at the beginning, and use
> 'foo.bar' later on.

The fully explicit form can't be used with lazy importing?

Wouter van Heyst
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061108/00fd95a0/attachment.pgp 


More information about the bazaar mailing list