From 3d0a0dbd105c9346b6dc3ac1205f00453c2e7b51 Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Thu, 31 May 2007 00:22:06 +0000 Subject: remove pointless $PORTDIR lock svn path=/main/trunk/; revision=6682 --- pym/portage/news.py | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'pym/portage/news.py') diff --git a/pym/portage/news.py b/pym/portage/news.py index 327fe15f4..3cfb5de12 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -64,32 +64,22 @@ class NewsManager(object): timestamp = 0 path = os.path.join(self.portdb.getRepositoryPath(repoid), self.NEWS_PATH) - newsdir_lock = None - try: - repo_path = self.portdb.getRepositoryPath(repoid) - if os.access(os.path.dirname(repo_path), os.W_OK): - # This lock file should really be mapped into /var somewhere - # since the repo_path or it's parent directory may not even be - # writable. - newsdir_lock = lockdir(repo_path) - # Skip reading news for repoid if the news dir does not exist. Requested by - # NightMorph :) - if not os.path.exists(path): - return None - news = os.listdir(path) - updates = [] - for itemid in news: - try: - filename = os.path.join(path, itemid, itemid + "." + self.LANGUAGE_ID + ".txt") - item = NewsItem(filename, itemid, timestamp) - except (TypeError, ValueError), e: - continue - if item.isRelevant(profile=os.readlink(PROFILE_PATH), config=config, vardb=self.vdb): - updates.append(item) - finally: - if newsdir_lock: - unlockdir(newsdir_lock) - + + repo_path = self.portdb.getRepositoryPath(repoid) + # Skip reading news for repoid if the news dir does not exist. Requested by + # NightMorph :) + if not os.path.exists(path): + return None + news = os.listdir(path) + updates = [] + for itemid in news: + try: + filename = os.path.join(path, itemid, itemid + "." + self.LANGUAGE_ID + ".txt") + item = NewsItem(filename, itemid, timestamp) + except (TypeError, ValueError), e: + continue + if item.isRelevant(profile=os.readlink(PROFILE_PATH), config=config, vardb=self.vdb): + updates.append(item) del path path = os.path.join(self.UNREAD_PATH, "news-"+repoid+".unread") -- cgit v1.2.3-1-g7c22