From: Zac Medico Date: Sat, 26 Apr 2008 20:23:58 +0000 (-0000) Subject: Add a PackageVirtualDbapi.copy() method. X-Git-Tag: v2.2_pre6~106 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b56f8f7640ea200997876942726108adaacca0dc;p=portage.git Add a PackageVirtualDbapi.copy() method. svn path=/main/trunk/; revision=9982 --- diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 1f50bbf9f..65375de0a 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -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 \