summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2009-10-27 21:30:50 +0100
committerStefan Ritter <xeno@thehappy.de>2009-10-27 21:30:50 +0100
commit96a3ddfc3f0ad35d48a19f4afc0ce3d46b911664 (patch)
tree35a5e78e3b939060464b68ca442f9a9bb78c1ef8
parent683e266fee80594e5123bce2776d7fa8b595453b (diff)
Added description of packages (optional), some cleanup
-rwxr-xr-xwnpp-query.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/wnpp-query.py b/wnpp-query.py
index 058fd22..bceefb1 100755
--- a/wnpp-query.py
+++ b/wnpp-query.py
@@ -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:
+ 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] + ')'