Fix the Debian.version regexps and fully propagate the Zegrep -> Zgrep

renaming that occured a few days ago.
This commit is contained in:
James Vega 2004-02-11 23:39:47 +00:00
parent bd4451c3f6
commit 1f9d794943
2 changed files with 5 additions and 3 deletions

View File

@ -74,7 +74,7 @@ def configure(advanced):
about two orders of magnitude slower. THIS MEANS IT about two orders of magnitude slower. THIS MEANS IT
WILL TAKE AGES TO RUN THIS COMMAND. Don't do this.""") WILL TAKE AGES TO RUN THIS COMMAND. Don't do this.""")
if yn('Do you want to use a Python equivalent of zgrep?'): if yn('Do you want to use a Python equivalent of zgrep?'):
conf.supybot.plugins.Debian.pythonZegrep.setValue(True) conf.supybot.plugins.Debian.pythonZgrep.setValue(True)
else: else:
output('I\'ll disable file now.') output('I\'ll disable file now.')
conf.supybot.defaultCapabilities().add('-Debian.file') conf.supybot.defaultCapabilities().add('-Debian.file')
@ -136,7 +136,7 @@ class Debian(callbacks.Privmsg,
except re.error, e: except re.error, e:
irc.error("Error in regexp: %s" % e) irc.error("Error in regexp: %s" % e)
return return
if self.registryValue('pythonZegrep'): if self.registryValue('pythonZgrep'):
fd = gzip.open(self.contents) fd = gzip.open(self.contents)
r = imap(lambda tup: tup[0], r = imap(lambda tup: tup[0],
ifilter(lambda tup: tup[0], ifilter(lambda tup: tup[0],
@ -177,7 +177,7 @@ class Debian(callbacks.Privmsg,
_debreflags = re.DOTALL | re.IGNORECASE _debreflags = re.DOTALL | re.IGNORECASE
_debbrre = re.compile(r'<li><a href[^>]+>(.*?)</a> \(', _debreflags) _debbrre = re.compile(r'<li><a href[^>]+>(.*?)</a> \(', _debreflags)
_debverre = re.compile(r'<br>\d+?:(\S+):', _debreflags) _debverre = re.compile(r'<br>(?:\d+:)?(\S+):', _debreflags)
_deblistre = re.compile(r'<h3>Package ([^<]+)</h3>(.*?)</ul>', _debreflags) _deblistre = re.compile(r'<h3>Package ([^<]+)</h3>(.*?)</ul>', _debreflags)
_debBranches = ('stable', 'testing', 'unstable', 'experimental') _debBranches = ('stable', 'testing', 'unstable', 'experimental')
def version(self, irc, msg, args): def version(self, irc, msg, args):

View File

@ -68,6 +68,8 @@ if network:
r'^No package.*\(unstable\)') r'^No package.*\(unstable\)')
self.assertRegexp('debian version gaim', self.assertRegexp('debian version gaim',
r'\d+ matches found:.*gaim.*\(stable') r'\d+ matches found:.*gaim.*\(stable')
self.assertRegexp('debian version linux-wlan',
r'\d+ matches found:.*linux-wlan.*')
self.assertError('debian version unstable') self.assertError('debian version unstable')
def testDebfile(self): def testDebfile(self):