Make PackageSet._setAtoms() use existing Atom instances when available.
authorZac Medico <zmedico@gentoo.org>
Sat, 31 May 2008 23:10:14 +0000 (23:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 31 May 2008 23:10:14 +0000 (23:10 -0000)
svn path=/main/trunk/; revision=10523

pym/portage/sets/base.py

index d9f2a8d91b034a95c553063998f083407ccbb535..416626320e97402e25c6ff713fd549a4e4dcc7df 100644 (file)
@@ -61,13 +61,18 @@ class PackageSet(object):
                self._atoms.clear()
                self._nonatoms.clear()
                for a in atoms:
-                       a = a.strip()
-                       if not a:
-                               continue
-                       try:
-                               self._atoms.add(Atom(a))
-                       except InvalidAtom:
-                               self._nonatoms.add(a)
+                       if not isinstance(a, Atom):
+                               if isinstance(a, basestring):
+                                       a = a.strip()
+                               if not a:
+                                       continue
+                               try:
+                                       a = Atom(a)
+                               except InvalidAtom:
+                                       self._nonatoms.add(a)
+                                       continue
+                       self._atoms.add(a)
+
                self._updateAtomMap()
 
        def load(self):