X-Git-Url: https://git.decadent.org.uk/gitweb/?p=dak.git;a=blobdiff_plain;f=tools%2Fqueue_rss.py;h=fd49c0dfe1f0173a7c0fd343e7ed37a1af5cd9bc;hp=fd67d5bd3ab0bd4a222bae83313f899405bc75e7;hb=80108bebf0307acfc27d586e6faffe193199b14b;hpb=f0bfd37e7286156598d79b53501ebe2000bb7924 diff --git a/tools/queue_rss.py b/tools/queue_rss.py index fd67d5bd..fd49c0df 100755 --- a/tools/queue_rss.py +++ b/tools/queue_rss.py @@ -14,10 +14,11 @@ import sys import time from optparse import OptionParser from datetime import datetime +from email.utils import parseaddr import PyRSS2Gen -from debian_bundle.deb822 import Changes +from debian.deb822 import Changes inrss_filename = "NEW_in.rss" outrss_filename = "NEW_out.rss" @@ -42,12 +43,12 @@ class Status: def __init__(self): self.feed_in = PyRSS2Gen.RSS2( title = "Packages entering NEW", - link = "http://ftp-master.debian.org/new.html", + link = "https://ftp-master.debian.org/new.html", description = "Debian packages entering the NEW queue" ) self.feed_out = PyRSS2Gen.RSS2( title = "Packages leaving NEW", - link = "http://ftp-master.debian.org/new.html", + link = "https://ftp-master.debian.org/new.html", description = "Debian packages leaving the NEW queue" ) self.queue = {} @@ -103,7 +104,7 @@ def parse_leave_reason(fname): try: f = open(fname) - except IOError, e: + except IOError as e: sys.stderr.write("Can't open %s: %s\n" % (fname, e)) return {} @@ -138,15 +139,18 @@ def add_rss_item(status, msg, direction): (cgi.escape(msg['Description']), cgi.escape(msg['Changes'])) - link = "http://ftp-master.debian.org/new/%s_%s.html" % \ + link = "https://ftp-master.debian.org/new/%s_%s.html" % \ (msg['Source'], msg['Version']) + maintainer = parseaddr(msg['Maintainer']) + author = "%s (%s)" % (maintainer[1], maintainer[0]) + feed.items.insert(0, PyRSS2Gen.RSSItem( title, pubDate = pubdate, description = description, - author = cgi.escape(msg['Maintainer']), + author = cgi.escape(author), link = link, guid = link ) @@ -198,10 +202,6 @@ if __name__ == "__main__": status = Status() current_queue = parse_queuedir(settings.queuedir) - if not current_queue: - sys.stderr.write("Unable to scan queuedir '%s'\n" % settings.queuedir) - parser.print_help() - sys.exit(1) update_feeds(current_queue, status, settings) @@ -214,7 +214,7 @@ if __name__ == "__main__": try: status.feed_in.write_xml(file(feed_in_file, "w+"), "utf-8") status.feed_out.write_xml(file(feed_out_file, "w+"), "utf-8") - except IOError, why: + except IOError as why: sys.stderr.write("Unable to write feeds: %s\n", why) sys.exit(1) @@ -222,7 +222,7 @@ if __name__ == "__main__": try: cPickle.dump(status, open(status_db, "w+")) - except IOError, why: + except IOError as why: sys.stderr.write("Unable to save status: %s\n", why) sys.exit(1)