diff options
author | Alec Warner <antarus@gentoo.org> | 2007-01-16 01:36:45 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2007-01-16 01:36:45 +0000 |
commit | 03043f6a0f9220f7764950a33cfe856de7e119ce (patch) | |
tree | 7a888fb6916ed1e63eb663e6ea7b0ef52eb72d6e /pym/portage_news.py | |
parent | adb0ec0ada8e82dc4d32a20c821db4edfc89be5e (diff) | |
download | portage-03043f6a0f9220f7764950a33cfe856de7e119ce.tar.gz portage-03043f6a0f9220f7764950a33cfe856de7e119ce.tar.bz2 portage-03043f6a0f9220f7764950a33cfe856de7e119ce.zip |
ferringb pointed out this portroot parameter, ended up not using it, try an os.path.exists to save a very common (and slow) except on missing repo_name files for overlays, use a dict to facility a nicer regex comparison loop for news restrictions.
svn path=/main/trunk/; revision=5662
Diffstat (limited to 'pym/portage_news.py')
-rw-r--r-- | pym/portage_news.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/pym/portage_news.py b/pym/portage_news.py index ea804f31b..736ce3fdc 100644 --- a/pym/portage_news.py +++ b/pym/portage_news.py @@ -163,21 +163,14 @@ class NewsItem(object): #will never match if not line.startswith("D"): continue - match = _installedRE.match( line ) - if match: - self.restrictions.append( - DisplayInstalledRestriction( match.groups()[0].strip().rstrip() ) ) - continue - match = _profileRE.match( line ) - if match: - self.restrictions.append( - DisplayProfileRestriction( match.groups()[0].strip().rstrip() ) ) - continue - match = _keywordRE.match( line ) - if match: - self.restrictions.append( - DisplayKeywordRestriction( match.groups()[0].strip().rstrip() ) ) - continue + restricts = { _installedRE : DisplayInstalledRestriction, + _profileRE : DisplayProfileRestriction, + _keywordRE : DisplayKeywordRestriction } + for regex, restriction in restricts.iteritems(): + match = regex.match(line) + if match: + self.restrictions.append( restriction( match.groups()[0].strip() ) ) + continue self._parsed = True def __getattr__( self, attr ): |