From 5613e39cd5b8a9edea3da86359d8597060b9d89b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 25 May 2008 08:19:22 +0000 Subject: [PATCH] Facilitate creation of Atom instances in a few obvious places: * PackageSet._setAtoms() * AtomArg and PackageArg constructors. (trunk r10413) svn path=/main/branches/2.1.2/; revision=10414 --- bin/emerge | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/emerge b/bin/emerge index 47c095e89..13cdb01c9 100755 --- a/bin/emerge +++ b/bin/emerge @@ -782,22 +782,30 @@ class SetConfig(object): class InternalPackageSet(object): def __init__(self, initial_atoms=None): self._atoms = {} + self._nonatoms = set() if initial_atoms: self.update(initial_atoms) def clear(self): self._atoms.clear() + self._nonatoms.clear() def add(self, atom): - cp = portage.dep_getkey(atom) - cp_list = self._atoms.get(cp) + try: + atom = portage_dep.Atom(atom) + except portage_dep.InvalidAtom: + self._nonatoms.add(atom) + return + cp_list = self._atoms.get(atom.cp) if cp_list is None: cp_list = [] - self._atoms[cp] = cp_list + self._atoms[atom.cp] = cp_list if atom not in cp_list: cp_list.append(atom) def update(self, atoms): for atom in atoms: self.add(atom) def __contains__(self, atom): + if atom in self._nonatoms: + return True cp = portage.dep_getkey(atom) if cp in self._atoms and atom in self._atoms[cp]: return True @@ -1475,13 +1483,15 @@ class AtomArg(DependencyArg): def __init__(self, atom=None, **kwargs): DependencyArg.__init__(self, **kwargs) self.atom = atom + if not isinstance(self.atom, portage_dep.Atom): + self.atom = portage_dep.Atom(self.atom) self.set = (self.atom, ) class PackageArg(DependencyArg): def __init__(self, package=None, **kwargs): DependencyArg.__init__(self, **kwargs) self.package = package - self.atom = "=" + package.cpv + self.atom = portage_dep.Atom("=" + package.cpv) self.set = (self.atom, ) class SetArg(DependencyArg): -- 2.26.2