def update_doap()

in scripts/project2attic.py [0:0]


def update_doap(doap, source):
    infile = doap
    tmpfile = doap + '.t'
    catWrite = True
    with open(infile,'r') as r, open(tmpfile,'w') as w:
        for l in r:
            if re.search("<rdf:RDF",l):
                w.write("<!-- Copied from %s -->\n" % source)
            if re.search("<asfext:pmc rdf:resource=", l):
                w.write(re.sub("=['\"].+?['\"]",'="http://attic.apache.org/"',l))
                continue # don't write original line
            if catWrite and re.search("<category",l):
                catWrite = False
                w.write('    <category rdf:resource="http://projects.apache.org/category/retired" />\n')
            w.write(l) # write the original line

    os.system("diff %s*" % (infile))
    os.rename(tmpfile,infile)