diff options
Diffstat (limited to 'tools/bundlecvt.py')
-rw-r--r-- | tools/bundlecvt.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/bundlecvt.py b/tools/bundlecvt.py index e69de29bb..cae4e2d23 100644 --- a/tools/bundlecvt.py +++ b/tools/bundlecvt.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# $Id: $ + +from os import listdir +from sys import argv +from elementtree.ElementTree import XML, Element, tostring + +if __name__ == '__main__': + bundles = argv[1] + translations = argv[2] + tdata = {} + + for t in listdir(translations): + data = XML(open("%s/%s"%(translations,t)).read()) + tdata[data.attrib['system']] = {'VConfig':{}, 'VPackage':{}, 'VService':{}, 'VFS':{}} + for entry in data.getchildren(): + if entry.tag == 'Image': + continue + tdata[data.attrib['system']][entry.tag][entry.attrib['name']] = entry.getchildren() + bundle = XML(open('/home/desai/data/bold/b/ssh.xml').read()) + + new = Element('Bundle', version='2.0', name=bundle.attrib['name']) + + for system in tdata.keys(): + b = Element("System", name=system) + for entry in bundle.getchildren(): + map(b.append, tdata[system][entry.tag][entry.attrib['name']]) + new.append(b) + + print tostring(new) + |