From 4b29012d31e05d746763c9c103fbb00cda0f5c04 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 28 Jun 2006 18:11:48 +0000 Subject: [PATCH] Allow a config instance to be passed into cpv_expand so that it doesn't have to rely on global settings. svn path=/main/trunk/; revision=3684 --- pym/portage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pym/portage.py b/pym/portage.py index 9e51c1b1f..29709b47f 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3562,14 +3562,15 @@ def key_expand(mykey, mydb=None, use_cache=1, settings=None): return virts[mykey][0] return mykey -def cpv_expand(mycpv,mydb=None,use_cache=1): +def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None): """Given a string (packagename or virtual) expand it into a valid cat/package string. Virtuals use the mydb to determine which provided virtual is a valid choice and defaults to the first element when there are no installed/available candidates.""" myslash=mycpv.split("/") mysplit=pkgsplit(myslash[-1]) - global settings + if settings is None: + settings = globals()["settings"] virts = settings.getvirtuals("/") virts_p = settings.get_virts_p("/") if len(myslash)>2: -- 2.26.2