Debian.incoming: glob is now required. Change glob behavior to match the rest

of supybot's globs.
This commit is contained in:
James Vega 2003-12-08 16:59:46 +00:00
parent 607793b6b4
commit fc1fc32a01
2 changed files with 9 additions and 4 deletions

View File

@ -242,7 +242,7 @@ class Debian(callbacks.Privmsg,
_incomingRe = re.compile(r'<a href="(.*?\.deb)">', re.I) _incomingRe = re.compile(r'<a href="(.*?\.deb)">', re.I)
def incoming(self, irc, msg, args): def incoming(self, irc, msg, args):
"""[--{regexp,arch}=<value>] [<glob>] """[--{regexp,arch}=<value>] <glob>
Checks debian incoming for a matching package name. The arch Checks debian incoming for a matching package name. The arch
parameter defaults to i386; --regexp returns only those package names parameter defaults to i386; --regexp returns only those package names
@ -264,8 +264,11 @@ class Debian(callbacks.Privmsg,
arg = '_%s.' % arg arg = '_%s.' % arg
archPredicate = lambda s, arg=arg: (arg in s) archPredicate = lambda s, arg=arg: (arg in s)
predicates.append(archPredicate) predicates.append(archPredicate)
for arg in rest: globs = privmsgs.getArgs(rest)
predicates.append(lambda s: fnmatch.fnmatch(s, arg)) for glob in globs:
if '?' not in glob and '*' not in glob:
glob = '*%s*' % glob
predicates.append(lambda s: fnmatch.fnmatch(s, glob))
packages = [] packages = []
fd = urllib2.urlopen('http://incoming.debian.org/') fd = urllib2.urlopen('http://incoming.debian.org/')
for line in fd: for line in fd:

View File

@ -58,6 +58,7 @@ class DebianTestCase(PluginTestCase, PluginDocumentation):
pass pass
def testDebversion(self): def testDebversion(self):
self.assertHelp('debian version')
self.assertRegexp('debian version lakjdfad', r'^No package.*\(all\)') self.assertRegexp('debian version lakjdfad', r'^No package.*\(all\)')
self.assertRegexp('debian version unstable alkdjfad', self.assertRegexp('debian version unstable alkdjfad',
r'^No package.*\(unstable\)') r'^No package.*\(unstable\)')
@ -66,12 +67,13 @@ class DebianTestCase(PluginTestCase, PluginDocumentation):
self.assertError('debian version unstable') self.assertError('debian version unstable')
def testDebfile(self): def testDebfile(self):
self.assertHelp('file')
if not self.fileDownloaded: if not self.fileDownloaded:
pass pass
self.assertRegexp('file --exact bin/gaim', r'net/gaim') self.assertRegexp('file --exact bin/gaim', r'net/gaim')
def testDebincoming(self): def testDebincoming(self):
self.assertNotError('incoming') self.assertHelp('incoming')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: