public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/portage/package/ebuild/
Date: Mon, 25 Jan 2016 08:40:29 +0000 (UTC)	[thread overview]
Message-ID: <1453711166.34f4f163eaadbccb0e37dbb780278bfacb8e8edb.zmedico@gentoo> (raw)

commit:     34f4f163eaadbccb0e37dbb780278bfacb8e8edb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 25 08:38:44 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan 25 08:39:26 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=34f4f163

Fix KeyError for ACCEPT_KEYWORDS and ARCH (bug 572826)

Use the "get" method to avoid triggering a KeyError when the profile is
invalid.

Fixes: 39d81c514c33 ("[...]config.__getitem__(): Partially drop backward compatibility for nonexistent keys.")
X-Gentoo-Bug: 572826
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=572826

 pym/portage/_legacy_globals.py       | 2 +-
 pym/portage/news.py                  | 2 +-
 pym/portage/package/ebuild/config.py | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/portage/_legacy_globals.py b/pym/portage/_legacy_globals.py
index bb9691a..f916cc6 100644
--- a/pym/portage/_legacy_globals.py
+++ b/pym/portage/_legacy_globals.py
@@ -56,7 +56,7 @@ def _get_legacy_global(name):
 	portage.features = settings.features
 	constructed.add('features')
 
-	portage.groups = settings["ACCEPT_KEYWORDS"].split()
+	portage.groups = settings.get("ACCEPT_KEYWORDS", "").split()
 	constructed.add('groups')
 
 	portage.pkglines = settings.packages

diff --git a/pym/portage/news.py b/pym/portage/news.py
index 54d4dc9..784ba70 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -338,7 +338,7 @@ class DisplayKeywordRestriction(DisplayRestriction):
 		self.keyword = keyword
 
 	def checkRestriction(self, **kwargs):
-		if kwargs['config']['ARCH'] == self.keyword:
+		if kwargs['config'].get('ARCH', '') == self.keyword:
 			return True
 		return False
 

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 0bae55b..45b7d08 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1082,7 +1082,7 @@ class config(object):
 		"""Validate miscellaneous settings and display warnings if necessary.
 		(This code was previously in the global scope of portage.py)"""
 
-		groups = self["ACCEPT_KEYWORDS"].split()
+		groups = self.get("ACCEPT_KEYWORDS", "").split()
 		archlist = self.archlist()
 		if not archlist:
 			writemsg(_("--- 'profiles/arch.list' is empty or "
@@ -1976,7 +1976,7 @@ class config(object):
 		# doesn't work properly as negative values are lost in the config
 		# object (bug #139600)
 		backuped_accept_keywords = self.configdict["backupenv"].get("ACCEPT_KEYWORDS", "")
-		global_accept_keywords = self["ACCEPT_KEYWORDS"]
+		global_accept_keywords = self.get("ACCEPT_KEYWORDS", "")
 
 		return self._keywords_manager.getMissingKeywords(cpv, metadata["SLOT"], \
 			metadata.get("KEYWORDS", ""), metadata.get('repository'), \


             reply	other threads:[~2016-01-25  8:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25  8:40 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-03-12 20:12 [gentoo-commits] proj/portage:master commit in: pym/portage/, pym/portage/package/ebuild/ Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453711166.34f4f163eaadbccb0e37dbb780278bfacb8e8edb.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox