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 E4E8213838B for ; Mon, 22 Sep 2014 11:49:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 75CFAE09A5; Mon, 22 Sep 2014 11:49:07 +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 10F59E099F for ; Mon, 22 Sep 2014 11:49:06 +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 4E33734003C for ; Mon, 22 Sep 2014 11:49:05 +0000 (UTC) From: Alexander Berntsen To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] [PATCHv3] Offer to read news while calcing deps (bug 517310) Date: Mon, 22 Sep 2014 13:48:57 +0200 Message-Id: <1411386537-31278-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: b21afcfe-3444-4bc4-9b76-d1ced3003091 X-Archives-Hash: 2dcbdbcdfc4095e458a843ba5d3aa70b Signed-off-by: Alexander Berntsen --- Fix some comment snafus that Arfrever spotted. 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..ff7512a 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.3 will throw a FileNotFoundError, which is a + # 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