From 14ec774fe8991bbe3bf9d97fc4ac64a5c3eaec38 Mon Sep 17 00:00:00 2001 From: James Vega Date: Thu, 1 Apr 2004 15:01:26 +0000 Subject: [PATCH] *finally* got the Debian.incoming globbing fixed. fnmatch.fnmatch is wonky --- plugins/Debian.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Debian.py b/plugins/Debian.py index 105a5b19d..8989315c8 100644 --- a/plugins/Debian.py +++ b/plugins/Debian.py @@ -253,11 +253,10 @@ class Debian(callbacks.Privmsg, arg = '_%s.' % arg archPredicate = lambda s, arg=arg: (arg in s) predicates.append(archPredicate) - globs = privmsgs.getArgs(rest) + globs = privmsgs.getArgs(rest).split() for glob in globs: - if '?' not in glob and '*' not in glob: - glob = '*%s*' % glob - predicates.append(lambda s: fnmatch.fnmatch(s, glob)) + glob = glob.replace('*', '.*').replace('?', '.?') + predicates.append(re.compile(r'.*%s.*' % glob).search) packages = [] try: fd = webutils.getUrlFd('http://incoming.debian.org/') @@ -268,7 +267,7 @@ class Debian(callbacks.Privmsg, m = self._incomingRe.search(line) if m: name = m.group(1) - if all(lambda p: p(name), predicates): + if all(None, imap(lambda p: p(name), predicates)): realname = rsplit(name, '_', 1)[0] packages.append(realname) if len(packages) == 0: