diff options
-rw-r--r-- | pym/_emerge/actions.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 3477c19d8..82adca794 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -30,7 +30,7 @@ from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_SET_CONFIG from portage.dbapi.dep_expand import dep_expand from portage.dbapi._expand_new_virt import expand_new_virt from portage.dep import Atom, extended_cp_match -from portage.exception import InvalidAtom +from portage.exception import InvalidAtom, PermissionDenied from portage.output import blue, bold, colorize, create_color_func, darkgreen, \ red, yellow good = create_color_func("GOOD") @@ -3049,13 +3049,26 @@ def display_news_notification(root_config, myopts): NEWS_PATH = os.path.join("metadata", "news") UNREAD_PATH = os.path.join(target_root, NEWS_LIB_PATH, "news") newsReaderDisplay = False - update = "--pretend" not in myopts if "news" not in settings.features: return + permission_msgs = set() for repo in portdb.getRepositories(): - unreadItems = checkUpdatedNewsItems( - portdb, vardb, NEWS_PATH, UNREAD_PATH, repo, update=update) + try: + unreadItems = checkUpdatedNewsItems( + portdb, vardb, NEWS_PATH, UNREAD_PATH, repo, update=True) + except PermissionDenied as e: + # NOTE: The NewsManager typically handles permission errors by + # returning silently, so PermissionDenied won't necessarily be + # raised even if we do trigger a permission error above. + msg = _unicode_decode("Permission denied: '%s'\n") % (e,) + if msg in permission_msgs: + pass + else: + permission_msgs.add(msg) + writemsg_level(msg, level=logging.ERROR, noiselevel=-1) + unreadItems = None + if unreadItems: if not newsReaderDisplay: newsReaderDisplay = True |