Make key_expand() always return Atom type.
authorZac Medico <zmedico@gentoo.org>
Mon, 21 Sep 2009 13:16:12 +0000 (13:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 21 Sep 2009 13:16:12 +0000 (13:16 -0000)
svn path=/main/trunk/; revision=14319

pym/portage/__init__.py

index d4b44d29aecf4db05fcc6167486f608085b77b8e..4b19cb9d9ff790c58ffe9601d3aae257e0bdc92a 100644 (file)
@@ -8068,15 +8068,17 @@ def key_expand(mykey, mydb=None, use_cache=1, settings=None):
                if hasattr(mydb, "cp_list"):
                        for x in mydb.categories:
                                if mydb.cp_list(x+"/"+mykey,use_cache=use_cache):
-                                       return x+"/"+mykey
+                                       return dep.Atom(x + "/" + mykey)
                        if mykey in virts_p:
                                return(virts_p[mykey][0])
-               return "null/"+mykey
+               return dep.Atom("null/" + mykey)
        elif mydb:
                if hasattr(mydb, "cp_list"):
                        if not mydb.cp_list(mykey, use_cache=use_cache) and \
                                virts and mykey in virts:
                                return virts[mykey][0]
+               if not isinstance(mykey, dep.Atom):
+                       mykey = dep.Atom(mykey)
                return mykey
 
 def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):