From f363a020a74df08d46dd4fa8b43a5fab85034951 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 9 Nov 2011 10:13:17 -0800 Subject: [PATCH] Use get(REQUIRED_USE) for emphasis. None of these cases should raise KeyError, but use get(REQUIRED_USE) anyway to emphasize that care must be taken. --- pym/_emerge/depgraph.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 2296aa001..fda335fcc 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1089,7 +1089,7 @@ class depgraph(object): # package selection, since we want to prompt the user # for USE adjustment rather than have REQUIRED_USE # affect package selection and || dep choices. - if not pkg.built and pkg.metadata["REQUIRED_USE"] and \ + if not pkg.built and pkg.metadata.get("REQUIRED_USE") and \ eapi_has_required_use(pkg.metadata["EAPI"]): required_use_is_sat = check_required_use( pkg.metadata["REQUIRED_USE"], @@ -3011,7 +3011,7 @@ class depgraph(object): raise if not mreasons and \ not pkg.built and \ - pkg.metadata["REQUIRED_USE"] and \ + pkg.metadata.get("REQUIRED_USE") and \ eapi_has_required_use(pkg.metadata["EAPI"]): if not check_required_use( pkg.metadata["REQUIRED_USE"], @@ -3692,7 +3692,7 @@ class depgraph(object): if new_changes != old_changes: #Don't do the change if it violates REQUIRED_USE. - required_use = pkg.metadata["REQUIRED_USE"] + required_use = pkg.metadata.get("REQUIRED_USE") if required_use and check_required_use(required_use, old_use, pkg.iuse.is_valid_flag) and \ not check_required_use(required_use, new_use, pkg.iuse.is_valid_flag): return old_use -- 2.26.2