#!/usr/bin/python2.2 # Make sure tabs expand to 8 spaces in vim # vim: expandtab # Copyright 2002 Raphaël Hertzog # This file is distributed under the terms of the General Public License # version 2 or (at your option) any later version. import os.path, rfc822, sys, string, re, cPickle from xml.dom import implementation, ext from config import dir, odir def striphtml(input): cleared = input.strip() # I have to clean it this way first because dependencies are copied raw # in update_excuses.html ... cleared = cleared.replace(">=", ">="); cleared = cleared.replace("<=", "<="); cleared = cleared.replace(">>", ">>"); cleared = cleared.replace("<<", "<<"); # Remove the tags while cleared.find("<") != -1 and cleared.find(">") != -1: cleared = cleared[:cleared.find("<")] + cleared[cleared.find(">")+1:] # But I really want the output in plain text cleared = cleared.replace(">=", ">="); cleared = cleared.replace("<=", "<="); cleared = cleared.replace(">>", ">>"); cleared = cleared.replace("<<", "<<"); return cleared # Load the list of excuses generated last time old_done = {} new_done = {} if os.path.exists(odir + "/excuses_done"): f = open(odir + "/excuses_done", "r") old_done = cPickle.load(f) f.close() f = open(dir + "/update_excuses.html", "r") # Ignore everything until first list while string.find(f.readline(), "") != -1: top = 1 if os.path.exists("%s/%s/%s" % (odir, hash, package)): excf = open("%s/%s/%s/excuse.xml" % (odir, hash, package), "w") ext.PrettyPrint(doc, excf, "iso-8859-1") excf.close() new_done[package] = 1 continue if line.find("