From fed0b979944958a7744510b6d3b59d02a789ba53 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 19 Feb 2010 21:54:54 +0000 Subject: [PATCH] Use Atom.cp instead of dep_getkey. svn path=/main/trunk/; revision=15401 --- pym/_emerge/depgraph.py | 11 ++++------- pym/portage/__init__.py | 7 +++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 9cb6ddf13..70b59dda2 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -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: diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index f28c4216f..378537190 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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 @@ -8532,7 +8535,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 -- 2.26.2