configure already sets TMPDIR to mixed path
[LibreOffice.git] / bin / check-autocorr.py
blobf865d3e891ce479bc8f06f6e386686a4a6eee1af
1 #!/usr/bin/env python3
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # Use this script to find the lines in extras/source/autocorr/lang/<language>/DocumentList.xml
10 # which contain the same value for abbreviated-name and name
11 # Usage sample: ./bin/check-autocorr.py extras/source/autocorr/lang/tr/DocumentList.xml
13 import sys
14 import xml.etree.ElementTree as ET
16 complete_file = sys.argv[1]
18 bAllFilesOk = True
20 # parse the XML file
21 tree = ET.parse(complete_file)
22 root = tree.getroot()
24 # find all elements X
25 elements_x = root.findall('.//block-list:block', namespaces={'block-list': "http://openoffice.org/2001/block-list"})
26 for element in elements_x:
27 # get the value of the attribute "abbreviated-name"
28 value_a = element.get('{http://openoffice.org/2001/block-list}abbreviated-name')
29 # get the value of the attribute "name"
30 value_b = element.get('{http://openoffice.org/2001/block-list}name')
31 # check if the values are equal
32 if value_a == value_b:
33 print('In ' + complete_file + ' same value: ' + value_a)
34 bAllFilesOk = False
36 if bAllFilesOk == True:
37 exit(0)
38 exit(1)