To ease the namespace transition, automatically translate cache.* to portage.cache...
authorZac Medico <zmedico@gentoo.org>
Fri, 25 May 2007 07:06:41 +0000 (07:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 25 May 2007 07:06:41 +0000 (07:06 -0000)
svn path=/main/trunk/; revision=6620

pym/portage/__init__.py
pym/portage/dbapi/porttree.py

index f79b525edc10a5c9dd3f8008558ef8687f91c6df..191d6d07055d45fcd7e8104be9b56e0ffef7b7d1 100644 (file)
@@ -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):
index b1177a4a0a72f8b0bd5c759b9e0c9b1fc3a83003..86d70416f2635f625d71808ca9b87eb714db82a3 100644 (file)
@@ -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()