From: Zac Medico Date: Fri, 25 May 2007 07:06:41 +0000 (-0000) Subject: To ease the namespace transition, automatically translate cache.* to portage.cache... X-Git-Tag: v2.2_pre1~1371 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0672c5b1bcde3b7f174d97da328ba1601bb35c0b;p=portage.git To ease the namespace transition, automatically translate cache.* to portage.cache.* if an ImportError occurs. svn path=/main/trunk/; revision=6620 --- 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()