summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-01-18 20:06:50 +0000
committerMarius Mauch <genone@gentoo.org>2007-01-18 20:06:50 +0000
commitd46eeafa99f68415d24b969424504d4c78325837 (patch)
treefc4d36f17829e368121e52f08e3ceb38d7ff2a60
parentf02fdec61d2c66f433e33ce49e06dc2ebf470afc (diff)
downloadportage-d46eeafa99f68415d24b969424504d4c78325837.tar.gz
portage-d46eeafa99f68415d24b969424504d4c78325837.tar.bz2
portage-d46eeafa99f68415d24b969424504d4c78325837.zip
Unified try-except-finally only works with python-2.5
svn path=/main/trunk/; revision=5711
-rw-r--r--pym/portage_news.py23
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)