Add a PackageVirtualDbapi.copy() method.
authorZac Medico <zmedico@gentoo.org>
Sat, 26 Apr 2008 20:23:58 +0000 (20:23 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 26 Apr 2008 20:23:58 +0000 (20:23 -0000)
svn path=/main/trunk/; revision=9982

pym/_emerge/__init__.py

index 1f50bbf9ff6cab0b34784a66366492446909a91a..65375de0ab03a17afba04789c80f94aac6e34987 100644 (file)
@@ -1513,6 +1513,15 @@ class PackageVirtualDbapi(portage.dbapi):
                self._cp_map = {}
                self._cpv_map = {}
 
+       def copy(self):
+               obj = PackageVirtualDbapi(self.settings)
+               obj._match_cache = self._match_cache.copy()
+               obj._cp_map = self._cp_map.copy()
+               for k, v in obj._cp_map.iteritems():
+                       obj._cp_map[k] = v[:]
+               obj._cpv_map = self._cpv_map.copy()
+               return obj
+
        def __contains__(self, item):
                existing = self._cpv_map.get(item.cpv)
                if existing is not None and \