summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-05-25 07:06:41 +0000
committerZac Medico <zmedico@gentoo.org>2007-05-25 07:06:41 +0000
commit0672c5b1bcde3b7f174d97da328ba1601bb35c0b (patch)
treee8ea673506a6922779ca7e78108f25b4202248f0
parent5064d13b2337bd0e7d16fab422585b73580323bb (diff)
downloadportage-0672c5b1bcde3b7f174d97da328ba1601bb35c0b.tar.gz
portage-0672c5b1bcde3b7f174d97da328ba1601bb35c0b.tar.bz2
portage-0672c5b1bcde3b7f174d97da328ba1601bb35c0b.zip
To ease the namespace transition, automatically translate cache.* to portage.cache.* if an ImportError occurs.
svn path=/main/trunk/; revision=6620
-rw-r--r--pym/portage/__init__.py11
-rw-r--r--pym/portage/dbapi/porttree.py3
2 files changed, 12 insertions, 2 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index f79b525ed..191d6d070 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1557,11 +1557,18 @@ class config:
def load_best_module(self,property_string):
best_mod = best_from_dict(property_string,self.modules,self.module_priority)
+ mod = None
try:
mod = load_mod(best_mod)
except ImportError:
- dump_traceback(red("Error: Failed to import module '%s'") % best_mod, noiselevel=0)
- sys.exit(1)
+ if best_mod.startswith("cache."):
+ best_mod = "portage." + best_mod
+ try:
+ mod = load_mod(best_mod)
+ except ImportError:
+ pass
+ if mod is None:
+ raise
return mod
def lock(self):
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index b1177a4a0..86d70416f 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -136,6 +136,9 @@ class portdbapi(dbapi):
pass
def close_caches(self):
+ if not hasattr(self, "auxdb"):
+ # unhandled exception thrown from constructor
+ return
for x in self.auxdb.keys():
self.auxdb[x].sync()
self.auxdb.clear()