Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/portage/package/ebuild/
Date: Mon, 25 Jan 2016 08:40:36
Message-Id: 1453711166.34f4f163eaadbccb0e37dbb780278bfacb8e8edb.zmedico@gentoo
1 commit: 34f4f163eaadbccb0e37dbb780278bfacb8e8edb
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 25 08:38:44 2016 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 25 08:39:26 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=34f4f163
7
8 Fix KeyError for ACCEPT_KEYWORDS and ARCH (bug 572826)
9
10 Use the "get" method to avoid triggering a KeyError when the profile is
11 invalid.
12
13 Fixes: 39d81c514c33 ("[...]config.__getitem__(): Partially drop backward compatibility for nonexistent keys.")
14 X-Gentoo-Bug: 572826
15 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=572826
16
17 pym/portage/_legacy_globals.py | 2 +-
18 pym/portage/news.py | 2 +-
19 pym/portage/package/ebuild/config.py | 4 ++--
20 3 files changed, 4 insertions(+), 4 deletions(-)
21
22 diff --git a/pym/portage/_legacy_globals.py b/pym/portage/_legacy_globals.py
23 index bb9691a..f916cc6 100644
24 --- a/pym/portage/_legacy_globals.py
25 +++ b/pym/portage/_legacy_globals.py
26 @@ -56,7 +56,7 @@ def _get_legacy_global(name):
27 portage.features = settings.features
28 constructed.add('features')
29
30 - portage.groups = settings["ACCEPT_KEYWORDS"].split()
31 + portage.groups = settings.get("ACCEPT_KEYWORDS", "").split()
32 constructed.add('groups')
33
34 portage.pkglines = settings.packages
35
36 diff --git a/pym/portage/news.py b/pym/portage/news.py
37 index 54d4dc9..784ba70 100644
38 --- a/pym/portage/news.py
39 +++ b/pym/portage/news.py
40 @@ -338,7 +338,7 @@ class DisplayKeywordRestriction(DisplayRestriction):
41 self.keyword = keyword
42
43 def checkRestriction(self, **kwargs):
44 - if kwargs['config']['ARCH'] == self.keyword:
45 + if kwargs['config'].get('ARCH', '') == self.keyword:
46 return True
47 return False
48
49
50 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
51 index 0bae55b..45b7d08 100644
52 --- a/pym/portage/package/ebuild/config.py
53 +++ b/pym/portage/package/ebuild/config.py
54 @@ -1082,7 +1082,7 @@ class config(object):
55 """Validate miscellaneous settings and display warnings if necessary.
56 (This code was previously in the global scope of portage.py)"""
57
58 - groups = self["ACCEPT_KEYWORDS"].split()
59 + groups = self.get("ACCEPT_KEYWORDS", "").split()
60 archlist = self.archlist()
61 if not archlist:
62 writemsg(_("--- 'profiles/arch.list' is empty or "
63 @@ -1976,7 +1976,7 @@ class config(object):
64 # doesn't work properly as negative values are lost in the config
65 # object (bug #139600)
66 backuped_accept_keywords = self.configdict["backupenv"].get("ACCEPT_KEYWORDS", "")
67 - global_accept_keywords = self["ACCEPT_KEYWORDS"]
68 + global_accept_keywords = self.get("ACCEPT_KEYWORDS", "")
69
70 return self._keywords_manager.getMissingKeywords(cpv, metadata["SLOT"], \
71 metadata.get("KEYWORDS", ""), metadata.get('repository'), \