From: Zac Medico Date: Wed, 8 Sep 2010 21:00:55 +0000 (-0700) Subject: Make ResolverPlayground.run() use try/finally when saving/restoring X-Git-Tag: v2.2_rc78~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4488d106a4da0e4e201ff74555ac55974267edbe;p=portage.git Make ResolverPlayground.run() use try/finally when saving/restoring global variable settings. --- diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index 0b950059f..5c04afd98 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -315,25 +315,29 @@ class ResolverPlayground(object): if self.debug: options["--debug"] = True - if not self.debug: - portage.util.noiselimit = -2 - _emerge.emergelog._disable = True - - if options.get("--depclean"): - rval, cleanlist, ordered, req_pkg_count = \ - calc_depclean(self.settings, self.trees, None, - options, "depclean", atoms, None) - result = ResolverPlaygroundDepcleanResult( \ - atoms, rval, cleanlist, ordered, req_pkg_count) - else: - params = create_depgraph_params(options, action) - success, depgraph, favorites = backtrack_depgraph( - self.settings, self.trees, options, params, action, atoms, None) - depgraph.display_problems() - result = ResolverPlaygroundResult(atoms, success, depgraph, favorites) + global_noiselimit = portage.util.noiselimit + global_emergelog_disable = _emerge.emergelog._disable + try: - portage.util.noiselimit = 0 - _emerge.emergelog._disable = False + if not self.debug: + portage.util.noiselimit = -2 + _emerge.emergelog._disable = True + + if options.get("--depclean"): + rval, cleanlist, ordered, req_pkg_count = \ + calc_depclean(self.settings, self.trees, None, + options, "depclean", atoms, None) + result = ResolverPlaygroundDepcleanResult( \ + atoms, rval, cleanlist, ordered, req_pkg_count) + else: + params = create_depgraph_params(options, action) + success, depgraph, favorites = backtrack_depgraph( + self.settings, self.trees, options, params, action, atoms, None) + depgraph.display_problems() + result = ResolverPlaygroundResult(atoms, success, depgraph, favorites) + finally: + portage.util.noiselimit = global_noiselimit + _emerge.emergelog._disable = global_emergelog_disable return result