1 |
Signed-off-by: Alexander Berntsen <bernalex@g.o> |
2 |
--- |
3 |
I don't have time for any more playing with this. Please test it, and |
4 |
ACK it if it is OK. I will merge it when I get back if it's OK. :-] |
5 |
|
6 |
pym/_emerge/actions.py | 10 ++++++++-- |
7 |
pym/_emerge/post_emerge.py | 5 ++++- |
8 |
2 files changed, 12 insertions(+), 3 deletions(-) |
9 |
|
10 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
11 |
index b935139..45f9167 100644 |
12 |
--- a/pym/_emerge/actions.py |
13 |
+++ b/pym/_emerge/actions.py |
14 |
@@ -4058,8 +4058,14 @@ def run_action(emerge_config): |
15 |
|
16 |
# GLEP 42 says to display news *after* an emerge --pretend |
17 |
if "--pretend" not in emerge_config.opts: |
18 |
- display_news_notification( |
19 |
- emerge_config.target_config, emerge_config.opts) |
20 |
+ uq = UserQuery(emerge_config.opts) |
21 |
+ if display_news_notification(emerge_config.target_config, |
22 |
+ emerge_config.opts) \ |
23 |
+ and "--ask" in emerge_config.opts \ |
24 |
+ and uq.query("Would you like to read the news items while" \ |
25 |
+ "calculating dependencies?", |
26 |
+ '--ask-enter-invalid' in emerge_config.opts) == "Yes": |
27 |
+ subprocess.call(['eselect', 'news', 'read']) |
28 |
retval = action_build(emerge_config.target_config.settings, |
29 |
emerge_config.trees, emerge_config.target_config.mtimedb, |
30 |
emerge_config.opts, emerge_config.action, |
31 |
diff --git a/pym/_emerge/post_emerge.py b/pym/_emerge/post_emerge.py |
32 |
index d5f1ba5..0cb533c 100644 |
33 |
--- a/pym/_emerge/post_emerge.py |
34 |
+++ b/pym/_emerge/post_emerge.py |
35 |
@@ -37,11 +37,14 @@ def clean_logs(settings): |
36 |
|
37 |
def display_news_notification(root_config, myopts): |
38 |
if "news" not in root_config.settings.features: |
39 |
- return |
40 |
+ return False |
41 |
portdb = root_config.trees["porttree"].dbapi |
42 |
vardb = root_config.trees["vartree"].dbapi |
43 |
news_counts = count_unread_news(portdb, vardb) |
44 |
+ if all(v == 0 for v in news_counts.values()): |
45 |
+ return False |
46 |
display_news_notifications(news_counts) |
47 |
+ return True |
48 |
|
49 |
def show_depclean_suggestion(): |
50 |
out = portage.output.EOutput() |
51 |
-- |
52 |
1.8.5.5 |