Added description of packages (optional), some cleanup

This commit is contained in:
Stefan Ritter 2009-10-27 21:30:50 +01:00
parent 683e266fee
commit 96a3ddfc3f

View file

@ -15,6 +15,7 @@ from optparse import OptionParser
parser = OptionParser()
parser.add_option('-i', action='store_true', dest='itp', default=False, help='Query ITPs')
parser.add_option('-r', action='store_true', dest='rfp', default=False, help='Query RFPs')
parser.add_option('-d', action='store_true', dest='description', default=False, help='Show description of each package')
parser.add_option('--min', dest='min_days_old', type="int", help='Minimum age (in days)')
parser.add_option('--max', dest='max_days_old', type="int", help='Maximum age (in days)')
(options, args) = parser.parse_args()
@ -35,9 +36,9 @@ else: url = urllib2.urlopen('http://www.debian.org/devel/wnpp/requeste
for line in url:
if re.findall('bugs\.debian\.org', line) \
or re.match('requested(.*)ago', line) \
or re.match('^(.*)days in preparation\.$', line) \
or re.match('^in preparation since(.*)$', line):
or re.match('^requested(.*)$', line) \
or re.match('^in preparation since(.*)$', line) \
or re.match('^(.*)days in preparation\.$', line):
if re.match('^\<ul\>(.*),', line) \
or re.match ('^ \<li\>\<a href(.*)\</a\>,', line):
@ -51,24 +52,32 @@ for line in url:
name = name.split(':', 1)[0]
item.append(name)
if options.description:
description = line.strip()
description = ' (' + re.sub('</a>,', '', re.sub('(.*):(.*):', '', description))[:50].strip() + '...)'
item.append(description)
else:
item.append('')
if re.match('^requested(.*)$', line) \
or re.match('^(.*)days in preparation(.*)$', line) \
or re.match('^in preparation since yesterday(.*)$', line):
or re.match('^in preparation since yesterday\.$', line):
if options.itp:
if re.match('^in preparation since yesterday', line): days = '1'
if re.match('^in preparation since yesterday\.$', line): days = '1'
else: days = line.split(' ')[0]
else: days = line.split(' ')[1]
else:
if re.match('^requested yesterday\.$', line): days = '1'
else: days = line.split(' ')[1]
item.append(days)
if len(item) == 3:
if len(item) == 4:
reports.append(item)
item = []
for entry in reports:
if int(entry[2]) <= options.max_days_old \
and int(entry[2]) >= options.min_days_old:
print entry[1] + ': ' + entry[2] + ' days ago (' + entry[0] + ')'
if int(entry[3]) <= options.max_days_old \
and int(entry[3]) >= options.min_days_old:
print entry[1] + entry[2] + ': ' + entry[3] + ' days ago (' + entry[0] + ')'