From: Marius Mauch Date: Thu, 18 Jan 2007 20:06:50 +0000 (-0000) Subject: Unified try-except-finally only works with python-2.5 X-Git-Tag: v2.1.2-r3~20 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d46eeafa99f68415d24b969424504d4c78325837;p=portage.git Unified try-except-finally only works with python-2.5 svn path=/main/trunk/; revision=5711 --- 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)