Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] fakedbapi.cpv_exists: handle KeyError from _instance_key
Date: Thu, 24 Sep 2015 20:28:16
Message-Id: 1443126466-13739-1-git-send-email-zmedico@gentoo.org
1 Since commit 7921e61065502fd0bb08d9dfef6a4493657961bf, cpv_exists
2 needs to handle KeyError from _instance_key_multi_instance.
3
4 Fixes: 7921e6106550 ("binpkg-multi-instance 2 of 7")
5 ---
6 pym/portage/dbapi/virtual.py | 8 ++++++--
7 1 file changed, 6 insertions(+), 2 deletions(-)
8
9 diff --git a/pym/portage/dbapi/virtual.py b/pym/portage/dbapi/virtual.py
10 index a59c3b5..f2e841f 100644
11 --- a/pym/portage/dbapi/virtual.py
12 +++ b/pym/portage/dbapi/virtual.py
13 @@ -98,8 +98,12 @@ class fakedbapi(dbapi):
14 return result[:]
15
16 def cpv_exists(self, mycpv, myrepo=None):
17 - return self._instance_key(mycpv,
18 - support_string=True) in self.cpvdict
19 + try:
20 + return self._instance_key(mycpv,
21 + support_string=True) in self.cpvdict
22 + except KeyError:
23 + # _instance_key failure
24 + return False
25
26 def cp_list(self, mycp, use_cache=1, myrepo=None):
27 # NOTE: Cache can be safely shared with the match cache, since the
28 --
29 2.4.6

Replies