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

View File

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