summaryrefslogtreecommitdiffstats
path: root/scripts/oe-trim-schemas
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/oe-trim-schemas')
-rwxr-xr-xscripts/oe-trim-schemas63
1 files changed, 0 insertions, 63 deletions
diff --git a/scripts/oe-trim-schemas b/scripts/oe-trim-schemas
deleted file mode 100755
index e3b26e273e..0000000000
--- a/scripts/oe-trim-schemas
+++ /dev/null
@@ -1,63 +0,0 @@
1#! /usr/bin/env python3
2#
3# Copyright OpenEmbedded Contributors
4#
5# SPDX-License-Identifier: GPL-2.0-only
6#
7
8import sys
9try:
10 import xml.etree.cElementTree as etree
11except:
12 import xml.etree.ElementTree as etree
13
14def child (elem, name):
15 for e in elem.getchildren():
16 if e.tag == name:
17 return e
18 return None
19
20def children (elem, name=None):
21 l = elem.getchildren()
22 if name:
23 l = [e for e in l if e.tag == name]
24 return l
25
26if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'):
27 print('oe-trim-schemas: error: the following arguments are required: schema\n'
28 'Usage: oe-trim-schemas schema\n\n'
29 'OpenEmbedded trim schemas - remove unneeded schema locale translations\n'
30 ' from gconf schema files\n\n'
31 'arguments:\n'
32 ' schema gconf schema file to trim\n')
33 sys.exit(2)
34
35xml = etree.parse(sys.argv[1])
36
37for schema in child(xml.getroot(), "schemalist").getchildren():
38 e = child(schema, "short")
39 if e is not None:
40 schema.remove(e)
41
42 e = child(schema, "long")
43 if e is not None:
44 schema.remove(e)
45
46 for locale in children(schema, "locale"):
47 # One locale must exist so leave C locale...
48 a = locale.attrib.get("name")
49 if a == 'C':
50 continue
51 e = child(locale, "default")
52 if e is None:
53 schema.remove(locale)
54 else:
55 e = child(locale, "short")
56 if e is not None:
57 locale.remove(e)
58 e = child(locale, "long")
59 if e is not None:
60 locale.remove(e)
61
62xml.write(sys.stdout, "UTF-8")
63