From b56f8f7640ea200997876942726108adaacca0dc Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 26 Apr 2008 20:23:58 +0000 Subject: [PATCH] Add a PackageVirtualDbapi.copy() method. svn path=/main/trunk/; revision=9982 --- pym/_emerge/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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 \ -- 2.26.2