diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-12 03:56:20 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-12 03:56:20 -0700 |
commit | a75c3cb55fd3a6f8a33a521c12f8d66649020ea8 (patch) | |
tree | 315904d20879cbce58cec520b9556e2b0407191c | |
parent | b110b9f829e67e05900e8af039622113ff48f76e (diff) | |
download | portage-a75c3cb55fd3a6f8a33a521c12f8d66649020ea8.tar.gz portage-a75c3cb55fd3a6f8a33a521c12f8d66649020ea8.tar.bz2 portage-a75c3cb55fd3a6f8a33a521c12f8d66649020ea8.zip |
Fix lazyimport() to handle partially imported modules by creating
proxies, instead of raising ImportError.
-rw-r--r-- | pym/portage/proxy/lazyimport.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pym/portage/proxy/lazyimport.py b/pym/portage/proxy/lazyimport.py index b5d15931b..d878b7adc 100644 --- a/pym/portage/proxy/lazyimport.py +++ b/pym/portage/proxy/lazyimport.py @@ -199,7 +199,11 @@ def lazyimport(scope, *args): try: scope[alias] = getattr(already_imported, attr_name) except AttributeError: - raise ImportError('cannot import name %s' % attr_name) + # Apparently the target module is only partially + # imported, so create a proxy. + already_imported = None + scope[alias] = \ + _LazyImportFrom(scope, name, attr_name, alias) else: scope[alias] = \ _LazyImportFrom(scope, name, attr_name, alias) |