summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2009-10-27 17:02:56 +0100
committerStefan Ritter <xeno@thehappy.de>2009-10-27 17:02:56 +0100
commit683e266fee80594e5123bce2776d7fa8b595453b (patch)
treefc81f6e7ec55fc6b7f8271de9104af2163a5eddc
parent4f62f46fe9cc9b74e0c2c7dfaf6355f5cd0815c0 (diff)
Code cleanup
-rwxr-xr-xwnpp-query.py48
1 files changed, 26 insertions, 22 deletions
diff --git a/wnpp-query.py b/wnpp-query.py
index fc0e0af..058fd22 100755
--- a/wnpp-query.py
+++ b/wnpp-query.py
@@ -12,7 +12,6 @@
import urllib2, sys, re
from optparse import OptionParser
-# Parse commandline arguments
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')
@@ -27,38 +26,41 @@ if not options.min_days_old and not options.max_days_old or not options.itp and
if not options.min_days_old: options.min_days_old = 0
if not options.max_days_old: options.max_days_old = 9999
-# Here we go...
reports = []
item = []
-if options.itp:
- url = urllib2.urlopen('http://www.debian.org/devel/wnpp/being_packaged')
-else:
- url = urllib2.urlopen('http://www.debian.org/devel/wnpp/requested')
+
+if options.itp: url = urllib2.urlopen('http://www.debian.org/devel/wnpp/being_packaged')
+else: url = urllib2.urlopen('http://www.debian.org/devel/wnpp/requested')
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):
- # First line
- if re.match('^\<ul\>(.*),', line) or re.match ('^ \<li\>\<a href(.*)\</a\>,', line):
- # Link
- link = re.sub('<ul>', '', line).strip() # First line starts with <ul>
+
+ 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):
+
+ if re.match('^\<ul\>(.*),', line) \
+ or re.match ('^ \<li\>\<a href(.*)\</a\>,', line):
+
+ link = re.sub('<ul>', '', line).strip()
link = line[14:43]
item.append(link)
- # Name
- name = re.sub('<ul>', '', line).strip() # First line starts with <ul>
+ name = re.sub('<ul>', '', line).strip()
name = name[44:]
name = name.split(':', 1)[0]
item.append(name)
- # Second line
- if re.match('^requested(.*)$', line) or re.match('^(.*)days in preparation(.*)$', line) or re.match('^in preparation since yesterday(.*)$', line):
+ if re.match('^requested(.*)$', line) \
+ or re.match('^(.*)days in preparation(.*)$', line) \
+ or re.match('^in preparation since yesterday(.*)$', line):
+
if options.itp:
- if re.match('^in preparation since yesterday', line):
- days = '1'
- else:
- days = line.split(' ')[0]
- else:
- days = line.split(' ')[1]
+
+ if re.match('^in preparation since yesterday', line): days = '1'
+ else: days = line.split(' ')[0]
+
+ else: days = line.split(' ')[1]
item.append(days)
if len(item) == 3:
@@ -66,5 +68,7 @@ for line in url:
item = []
for entry in reports:
- if int(entry[2]) <= options.max_days_old and int(entry[2]) >= options.min_days_old:
+ 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] + ')'