Re: Time for gnome 2.12 stats?



Hi Martin,

Today at 15:29, Martin Willemoes Hansen wrote:

>> Everything is "supposed" to be done only when someone gets around to
>> actually doing it :)  So far, I didn't see anyone step up (hint, hint :-P)
>
> Howto do it?

One would need to update gnome-i18n/status/data/translation-status.xml
file accordingly.  This would be tedious, so I've written a Python
script to do it (I'm attaching it here, I'll also commit it to
gnome-i18n/status/data/new-release), but I didn't test it extensively.

Christian Rose used to do this, and we should probably wait for his
approval before doing anything of this kind.


Now, I'd appreciate your help in checking that this doesn't break
anything (i.e. do the following:
  $ ./new-release | xmllint --format - >new.xml
  $ diff -u translation-status.xml new.xml
and only if everything looks fine in the diff
  $ cp new.xml translation-status.xml 
edit ChangeLog, and finally
  $ cvs ci
).  It's not easy this first time, since there are indentation
changes, but it should be easier in the future if we keep it "xmllint
--format"-indented.

Cheers,
Danilo


#!/usr/bin/env python
import sys
import libxml2

fn = 'translation-status.xml'
# remove this branch
rt = 'gnome-2.8'  # or sys.argv[1]
# to generate new branch, copy data from this branch
cf = 'gnome-2.10' # or sys.argv[2]
# and name new branch the following
ct = 'gnome-2.12' # or sys.argv[3]

def main(filename, removetag, copyfrom, copyto):
    try:
        ctxt = libxml2.createFileParserCtxt(filename)
        ctxt.lineNumbers(1)
        #ctxt.replaceEntities(1)
        ctxt.parseDocument()
        doc = ctxt.doc()
        if doc.name != filename:
            print >> sys.stderr, "Error: I tried to open '%s' but got '%s' -- how did that happen?" % (filename, doc.name)
            sys.exit(4)
    except:
        print >> sys.stderr, "Error: cannot open file '%s'." % (filename)
        sys.exit(1)

    root = doc.getRootElement() # <translation-status>

    # go through all releases and modules
    node = root.children
    while node:
        next = node.next
        if node.name == 'release':
            tag = node.prop("name")
            if tag == removetag:
                node.unlinkNode()
                node.freeNode()
            elif tag == copyfrom:
                newnode = node.copyNodeList()
                newnode.setProp("name", copyto)
                node.addNextSibling(newnode)
        elif node.name == 'module':
            child = node.children
            while child:
                vnext = child.next
                if child.name=="version":
                    rel = child.prop("release")
                    if rel == removetag:
                        child.unlinkNode()
                        child.freeNode()
                    elif rel == copyfrom:
                        newnode = child.copyNodeList()
                        newnode.setProp("release", copyto)
                        find = newnode.children
                        while find:
                            if find.name == "branch":
                                find.setProp("name", "HEAD")
                            find = find.next
                        child.addNextSibling(newnode)

                child = vnext
                    
        node = next

    print doc.serialize('utf-8')

main(fn, rt, cf, ct)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]