From f2770d06d66074e704454403515e516727a496cc Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 7 Jul 2011 23:46:28 -0700 Subject: [PATCH] cpv_expand: fix KeyError when settings is None --- pym/portage/dbapi/cpv_expand.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pym/portage/dbapi/cpv_expand.py b/pym/portage/dbapi/cpv_expand.py index 7077b1feb..947194cca 100644 --- a/pym/portage/dbapi/cpv_expand.py +++ b/pym/portage/dbapi/cpv_expand.py @@ -3,6 +3,7 @@ __all__ = ["cpv_expand"] +import portage from portage.exception import AmbiguousPackageName from portage.localization import _ from portage.util import writemsg @@ -16,7 +17,10 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None): myslash=mycpv.split("/") mysplit = _pkgsplit(myslash[-1]) if settings is None: - settings = globals()["settings"] + try: + settings = mydb.settings + except AttributeError: + settings = portage.settings if len(myslash)>2: # this is illegal case. mysplit=[] -- 2.26.2