summaryrefslogtreecommitdiffstats
path: root/scripts/oe-trim-schemas
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-04-20 23:24:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-04-21 00:29:31 +0100
commit2c2e61743c8d6620a04aa5cb534af78f51b2845e (patch)
tree769b7139eb86f49d9d78153c8e673ed8f04d9bde /scripts/oe-trim-schemas
parent0b70e298fbb2cf0a9aa1bab193a66a7edfe99e10 (diff)
downloadpoky-2c2e61743c8d6620a04aa5cb534af78f51b2845e.tar.gz
Rename the remaining poky-* scripts to oe-* or runqemu-*
(From OE-Core rev: 877b3d84597fcfc3abf5aa332019d412f2717896) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-trim-schemas')
-rw-r--r--scripts/oe-trim-schemas49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/oe-trim-schemas b/scripts/oe-trim-schemas
new file mode 100644
index 0000000000..29fb3a1b67
--- /dev/null
+++ b/scripts/oe-trim-schemas
@@ -0,0 +1,49 @@
1#! /usr/bin/env python
2
3import sys
4try:
5 import xml.etree.cElementTree as etree
6except:
7 import xml.etree.ElementTree as etree
8
9def child (elem, name):
10 for e in elem.getchildren():
11 if e.tag == name:
12 return e
13 return None
14
15def children (elem, name=None):
16 l = elem.getchildren()
17 if name:
18 l = [e for e in l if e.tag == name]
19 return l
20
21xml = etree.parse(sys.argv[1])
22
23for schema in child(xml.getroot(), "schemalist").getchildren():
24 e = child(schema, "short")
25 if e is not None:
26 schema.remove(e)
27
28 e = child(schema, "long")
29 if e is not None:
30 schema.remove(e)
31
32 for locale in children(schema, "locale"):
33 # One locale must exist so leave C locale...
34 a = locale.attrib.get("name")
35 if a == 'C':
36 continue
37 e = child(locale, "default")
38 if e is None:
39 schema.remove(locale)
40 else:
41 e = child(locale, "short")
42 if e is not None:
43 locale.remove(e)
44 e = child(locale, "long")
45 if e is not None:
46 locale.remove(e)
47
48xml.write(sys.stdout, "UTF-8")
49