Martin Pool wrote:
> 2009/12/16 Jonathan Lange <email address hidden>:
>>> Also, it seems like it might be nicer to lazily import lp_registration.
>>> I wouldn't expect a huge improvement to bzr startup time, but maybe
>>> something?
>>>
>>> Anyway, nothing you have to tweak, just a surprise on my part.
>>>
>> I tried to change this to use lazy_import. It turns out to be a whole bunch of hard.
>
> jml and i looked at this - lazy import is no better than just not
> loading the submodule til it's needed, and as it turns out it's
> harder.
>
Yeah, lazy import + deciding whether or not to do something based on
whether it is available is ... tricky. Because the import occurs during
the attribute lookup.
If we want to make it a dependency that py2exe won't find, then we would
do something like:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> 2009/12/16 Jonathan Lange <email address hidden>:
>>> Also, it seems like it might be nicer to lazily import lp_registration.
>>> I wouldn't expect a huge improvement to bzr startup time, but maybe
>>> something?
>>>
>>> Anyway, nothing you have to tweak, just a surprise on my part.
>>>
>> I tried to change this to use lazy_import. It turns out to be a whole bunch of hard.
>
> jml and i looked at this - lazy import is no better than just not
> loading the submodule til it's needed, and as it turns out it's
> harder.
>
Yeah, lazy import + deciding whether or not to do something based on
whether it is available is ... tricky. Because the import occurs during
the attribute lookup.
If we want to make it a dependency that py2exe won't find, then we would
do something like:
try: _('lp_api' )
lp_api = __import_
except ImportError:
...
If it still finds it, then
lazy_import( globals( ), """
import lp_api
""")
try:
getattr(lp_api, 'foo', None)
except ImportError:
...
It is pretty ugly, and I think we can just add a "don't include X" to
the setup.py code rather than hack around it that way.
John
=:->
-----BEGIN PGP SIGNATURE----- enigmail. mozdev. org/
o8YMACgkQJdeBCY SNAAOjhwCeOfU+ S9+LHny7f/ 6n5ZedqEy5 fX4JyeyagDnofY0 2WC6/O
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAks
YIUAn3mC7p+
=aDGj
-----END PGP SIGNATURE-----