Make PackageSet._setAtoms() use existing Atom instances when available.
authorZac Medico <zmedico@gentoo.org>
Sat, 31 May 2008 23:16:16 +0000 (23:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 31 May 2008 23:16:16 +0000 (23:16 -0000)
(trunk r10523)

svn path=/main/branches/2.1.2/; revision=10524

bin/emerge

index 22b9113094990cb8b7567edd403f5dc881cec3dc..818cf11c60832d0520c02fc7b89dd2264b43e95d 100755 (executable)
@@ -791,11 +791,17 @@ class InternalPackageSet(object):
                self._atoms.clear()
                self._nonatoms.clear()
        def add(self, atom):
-               try:
-                       atom = portage_dep.Atom(atom)
-               except portage_exception.InvalidAtom:
-                       self._nonatoms.add(atom)
-                       return
+               if not isinstance(atom, portage_dep.Atom):
+                       if isinstance(atom, basestring):
+                               atom = atom.strip()
+                       if not atom:
+                               return
+                       try:
+                               atom = portage_dep.Atom(atom)
+                       except portage_exception.InvalidAtom:
+                               self._nonatoms.add(atom)
+                               return
+
                cp_list = self._atoms.get(atom.cp)
                if cp_list is None:
                        cp_list = []