diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-07-23 12:56:55 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-07-23 09:47:13 -0700 |
commit | a58133d4682fe5fc6d2596d9e48fb3fbb6eb926d (patch) | |
tree | d952039a78734c5fbdafeecccc9a5e252b3ce45e /pym/portage/sets/base.py | |
parent | 429ac3a169b63d9841547ca1a045193586271489 (diff) | |
download | portage-a58133d4682fe5fc6d2596d9e48fb3fbb6eb926d.tar.gz portage-a58133d4682fe5fc6d2596d9e48fb3fbb6eb926d.tar.bz2 portage-a58133d4682fe5fc6d2596d9e48fb3fbb6eb926d.zip |
portage.sets: Add support for atoms with wildcards
Diffstat (limited to 'pym/portage/sets/base.py')
-rw-r--r-- | pym/portage/sets/base.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pym/portage/sets/base.py b/pym/portage/sets/base.py index 56f9df4ed..108dda3ec 100644 --- a/pym/portage/sets/base.py +++ b/pym/portage/sets/base.py @@ -4,7 +4,7 @@ import sys from portage.dep import Atom, best_match_to_list, match_from_list from portage.exception import InvalidAtom -from portage.versions import cpv_getkey +from portage.versions import catsplit, cpv_getkey if sys.hexversion >= 0x3000000: basestring = str @@ -76,7 +76,7 @@ class PackageSet(object): if not a: continue try: - a = Atom(a) + a = Atom(a, allow_wildcard=True) except InvalidAtom: self._nonatoms.add(a) continue @@ -126,7 +126,7 @@ class PackageSet(object): if atom.cp == pkg.cp: rev_transform[atom] = atom else: - rev_transform[Atom(atom.replace(atom.cp, pkg.cp, 1))] = atom + rev_transform[Atom(atom.replace(atom.cp, pkg.cp, 1), allow_wildcard=True)] = atom best_match = best_match_to_list(pkg, iter(rev_transform)) if best_match: return rev_transform[best_match] @@ -140,8 +140,15 @@ class PackageSet(object): """ cpv_slot_list = [pkg] cp = cpv_getkey(pkg.cpv) + c, p = catsplit(cp) self._load() # make sure the atoms are loaded - atoms = self._atommap.get(cp) + + atoms = set() + atoms.update(self._atommap.get("*/*", set())) + atoms.update(self._atommap.get(c+"/*", set())) + atoms.update(self._atommap.get("*/"+p, set())) + atoms.update(self._atommap.get(cp, set())) + if atoms: for atom in atoms: if match_from_list(atom, cpv_slot_list): @@ -171,7 +178,7 @@ class EditablePackageSet(PackageSet): for a in atoms: if not isinstance(a, Atom): try: - a = Atom(a) + a = Atom(a, allow_wildcard=True) except InvalidAtom: modified = True self._nonatoms.add(a) |