From: Zac Medico Date: Tue, 2 Mar 2010 20:45:50 +0000 (-0000) Subject: Use Atom.cp instead of dep_getkey. (trunk r15401) X-Git-Tag: v2.1.8~99 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=166ea3be5d3a6b8feb932c80abe4e5055ed586a9;p=portage.git Use Atom.cp instead of dep_getkey. (trunk r15401) svn path=/main/branches/2.1.7/; revision=15623 --- diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index fc44b357f..60f9f506e 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 5af4896c3..65674b963 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 @@ -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