A bit of cleanup work, mostly on the python zegrep portion of debfile

This commit is contained in:
Daniel DiPaolo 2003-09-15 02:45:39 +00:00
parent 6c898a8757
commit 467688de74

View File

@ -121,13 +121,16 @@ class Debian(callbacks.Privmsg, PeriodicFileDownloader):
# that). # that).
regexp = privmsgs.getArgs(args).lstrip('^/') regexp = privmsgs.getArgs(args).lstrip('^/')
try: try:
r = re.compile(regexp, re.I) re_obj = re.compile(regexp, re.I)
except re.error, e: except:
irc.error(msg, ) irc.error(msg, "Error in filename: %s" % regexp)
return return
if self.usePythonZegrep: if self.usePythonZegrep:
r = gzip.open(self.contents) fd = gzip.open(self.contents)
r = ifilter(imap(lambda line: r.search(line), fd)) r = imap(lambda tup: tup[0], \
ifilter(lambda tup: tup[0], \
imap(lambda line: (re_obj.search(line), line),
fd)))
(r, w) = popen2.popen4(['zegrep', regexp, self.contents]) (r, w) = popen2.popen4(['zegrep', regexp, self.contents])
packages = sets.Set() # Make packages unique packages = sets.Set() # Make packages unique
try: try: