blob: 176c9a46dd199802eebdeb0feb14ff7ff0dcf464 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env python
# $Id: $
from os import listdir
from sys import argv
from elementtree.ElementTree import XML, Element, tostring
if __name__ == '__main__':
bname = 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(bname).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():
try:
map(b.append, tdata[system][entry.tag][entry.attrib['name']])
except:
pass
new.append(b)
print tostring(new)
|