summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-26 20:23:58 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-26 20:23:58 +0000
commitb56f8f7640ea200997876942726108adaacca0dc (patch)
tree6e017eca1fede389d5e9f590b8a4f731a8be7b9c
parente21e34bed60810fe3a15a74d45c03d850890e13b (diff)
downloadportage-b56f8f7640ea200997876942726108adaacca0dc.tar.gz
portage-b56f8f7640ea200997876942726108adaacca0dc.tar.bz2
portage-b56f8f7640ea200997876942726108adaacca0dc.zip
Add a PackageVirtualDbapi.copy() method.
svn path=/main/trunk/; revision=9982
-rw-r--r--pym/_emerge/__init__.py9
1 files changed, 9 insertions, 0 deletions
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 \