From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 3A17F13838B for ; Mon, 22 Sep 2014 11:26:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D2B02E095C; Mon, 22 Sep 2014 11:26:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6B8C6E0950 for ; Mon, 22 Sep 2014 11:26:10 +0000 (UTC) Received: from hackintosh.gkp-asp.local (unknown [195.254.219.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bernalex) by smtp.gentoo.org (Postfix) with ESMTPSA id 0284833FCF3 for ; Mon, 22 Sep 2014 11:26:08 +0000 (UTC) From: Alexander Berntsen To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] [PATCH] Offer to read news while calcing deps (bug 517310) Date: Mon, 22 Sep 2014 13:26:01 +0200 Message-Id: <1411385161-29127-1-git-send-email-bernalex@gentoo.org> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1406923368-1285-1-git-send-email-bernalex@gentoo.org> References: <1406923368-1285-1-git-send-email-bernalex@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: d598afb6-714f-491d-bfcc-4073071ef08e X-Archives-Hash: 271f030303e0f3e0adeb32ba6a181c56 Signed-off-by: Alexander Berntsen --- Add exception in case eselect is not found. Fix output a tiny bit. pym/_emerge/actions.py | 17 +++++++++++++++-- pym/_emerge/post_emerge.py | 5 ++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index b935139..a050b79 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -4058,8 +4058,21 @@ def run_action(emerge_config): # GLEP 42 says to display news *after* an emerge --pretend if "--pretend" not in emerge_config.opts: - display_news_notification( - emerge_config.target_config, emerge_config.opts) + uq = UserQuery(emerge_config.opts) + if display_news_notification(emerge_config.target_config, + emerge_config.opts) \ + and "--ask" in emerge_config.opts \ + and uq.query("Would you like to read the news items while " \ + "calculating dependencies?", + '--ask-enter-invalid' in emerge_config.opts) == "Yes": + try: + subprocess.call(['eselect', 'news', 'read']) + # If eselect is not installed, Python <3.3 will throw an + # OSError. 3.4 will throw a FileNotFoundError, which is an + # subclass of OSError. + except OSError: + writemsg("Please install eselect to use this feature.\n", + noiselevel=-1) retval = action_build(emerge_config.target_config.settings, emerge_config.trees, emerge_config.target_config.mtimedb, emerge_config.opts, emerge_config.action, diff --git a/pym/_emerge/post_emerge.py b/pym/_emerge/post_emerge.py index d5f1ba5..0cb533c 100644 --- a/pym/_emerge/post_emerge.py +++ b/pym/_emerge/post_emerge.py @@ -37,11 +37,14 @@ def clean_logs(settings): def display_news_notification(root_config, myopts): if "news" not in root_config.settings.features: - return + return False portdb = root_config.trees["porttree"].dbapi vardb = root_config.trees["vartree"].dbapi news_counts = count_unread_news(portdb, vardb) + if all(v == 0 for v in news_counts.values()): + return False display_news_notifications(news_counts) + return True def show_depclean_suggestion(): out = portage.output.EOutput() -- 1.8.5.5