From b527c7554963282859602d9b9f0828ea3a50f4fd Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Tue, 27 Oct 2009 16:39:44 +0100 Subject: Added ITP functionality * Renamed to wnpp-query * Removed some more regexp --- wnpp-query.py | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 wnpp-query.py (limited to 'wnpp-query.py') diff --git a/wnpp-query.py b/wnpp-query.py new file mode 100755 index 0000000..7839fe3 --- /dev/null +++ b/wnpp-query.py @@ -0,0 +1,67 @@ +#!/usr/bin/python + +# This program is free software. It comes without any warranty, to +# the extent permitted by applicable law. You can redistribute it +# and/or modify it under the terms of the Do What The Fuck You Want +# To Public License, Version 2, as published by Sam Hocevar. See +# http://sam.zoy.org/wtfpl/COPYING for more details. + +# Author: Stefan Ritter +# Description: Query Debian WNPP pages + +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') +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() + +if not options.min_days_old and not options.max_days_old or not options.itp and not options.rfp or options.itp and options.rfp: + parser.error('You have to give at least one of --min or --max and one of -r or -i options.') + sys.exit + +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') + +for line in url: + if re.findall('bugs\.debian\.org', line) or re.match('requested(.*)ago', line) or re.match('(.*)days in preparation', line): + # First line + if re.match('^.ul.(.*),', line) or re.match ('^(.*)li.(.*),', line): + # Link + link = re.sub('