From: Zac Medico Date: Fri, 8 Jul 2011 06:46:28 +0000 (-0700) Subject: cpv_expand: fix KeyError when settings is None X-Git-Tag: v2.2.0_alpha44~48 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f2770d06d66074e704454403515e516727a496cc;p=portage.git cpv_expand: fix KeyError when settings is None --- 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=[]