Use Atom.cp instead of dep_getkey. (trunk r15401)
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:45:50 +0000 (20:45 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:45:50 +0000 (20:45 -0000)
svn path=/main/branches/2.1.7/; revision=15623

pym/_emerge/depgraph.py
pym/portage/__init__.py

index fc44b357fece169212402819de609f0cee33f0aa..60f9f506e0bfaf1e227ff1f023ee7da77daffb7c 100644 (file)
@@ -1819,8 +1819,7 @@ class depgraph(object):
                                                pprovided_match = False
                                                for virt_choice in virtuals.get(atom.cp, []):
                                                        expanded_atom = portage.dep.Atom(
-                                                               atom.replace(atom.cp,
-                                                               portage.dep_getkey(virt_choice), 1))
+                                                               atom.replace(atom.cp, virt_choice.cp, 1))
                                                        pprovided = pprovideddict.get(expanded_atom.cp)
                                                        if pprovided and \
                                                                portage.match_from_list(expanded_atom, pprovided):
@@ -3004,10 +3003,8 @@ class depgraph(object):
                        if provider_virtual:
                                atoms = []
                                for provider_entry in virtuals[blocker.cp]:
-                                       provider_cp = \
-                                               portage.dep_getkey(provider_entry)
                                        atoms.append(Atom(blocker.atom.replace(
-                                               blocker.cp, provider_cp)))
+                                               blocker.cp, provider_entry.cp, 1)))
                        else:
                                atoms = [blocker.atom]
 
@@ -5352,14 +5349,14 @@ class _dep_check_composite_db(portage.dbapi):
                if len(expanded_atoms) > 1:
                        non_virtual_atoms = []
                        for x in expanded_atoms:
-                               if not portage.dep_getkey(x).startswith("virtual/"):
+                               if not x.cp.startswith("virtual/"):
                                        non_virtual_atoms.append(x)
                        if len(non_virtual_atoms) == 1:
                                expanded_atoms = non_virtual_atoms
                if len(expanded_atoms) > 1:
                        # compatible with portage.cpv_expand()
                        raise portage.exception.AmbiguousPackageName(
-                               [portage.dep_getkey(x) for x in expanded_atoms])
+                               [x.cp for x in expanded_atoms])
                if expanded_atoms:
                        atom = expanded_atoms[0]
                else:
index 5af4896c30dc2cc6af7fcb65861665c4221b7474..65674b963af10db73a337634d724563043385ead 100644 (file)
@@ -3276,7 +3276,10 @@ class config(object):
                modified = False
                cp = dep.Atom(cpv_getkey(mycpv))
                for virt in virts:
-                       virt = dep_getkey(virt)
+                       try:
+                               virt = dep.Atom(virt).cp
+                       except exception.InvalidAtom:
+                               continue
                        providers = self.virtuals.get(virt)
                        if providers and cp in providers:
                                continue
@@ -8529,7 +8532,7 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
                                                # it may be necessary to remove the operator and
                                                # version from the atom before it is passed into
                                                # dbapi.cp_list().
-                                               if mydb.cp_list(dep_getkey(vkey), use_cache=use_cache):
+                                               if mydb.cp_list(vkey.cp):
                                                        mykey = str(vkey)
                                                        writemsg(_("virts chosen: %s\n") % (mykey), 1)
                                                        break