Allow a config instance to be passed into cpv_expand so that it doesn't have to rely...
authorZac Medico <zmedico@gentoo.org>
Wed, 28 Jun 2006 18:11:48 +0000 (18:11 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 28 Jun 2006 18:11:48 +0000 (18:11 -0000)
svn path=/main/trunk/; revision=3684

pym/portage.py

index 9e51c1b1f9c768e868f6c816f1d8bd9c402db31e..29709b47f298b6d50a5ba0ed7110b54ee00bba9f 100644 (file)
@@ -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: