diff options
-rw-r--r-- | pym/portage_news.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/pym/portage_news.py b/pym/portage_news.py index d3e5ea4f7..26d2607c7 100644 --- a/pym/portage_news.py +++ b/pym/portage_news.py @@ -123,17 +123,18 @@ class NewsManager(object): unreadfile = os.path.join( self.UNREAD_PATH, "news-"+ repoid +".unread" ) try: - unread_lock = lockfile(unreadfile) - # Set correct permissions on the news-repoid.unread file - apply_permissions( filename=unreadfile, - uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664 ) - - if os.path.exists( unreadfile ): - unread = open( unreadfile ).readlines() - if len(unread): - return len(unread) - except FileNotFound: - pass # unread file may not exist + try; + unread_lock = lockfile(unreadfile) + # Set correct permissions on the news-repoid.unread file + apply_permissions( filename=unreadfile, + uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664 ) + + if os.path.exists( unreadfile ): + unread = open( unreadfile ).readlines() + if len(unread): + return len(unread) + except FileNotFound: + pass # unread file may not exist finally: if unread_lock: unlockfile(unread_lock) |