android/mobile-config.py | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
New commits: commit df3942bba54e5588020082e0197b233d0f043282 Author: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> AuthorDate: Wed Jun 22 15:47:00 2022 +0300 Commit: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> CommitDate: Wed Jun 22 16:00:32 2022 +0200 Revert changes to android/mobile-config.py made in 157298bb808a943616991927f9370a86c1f2ca48 Got Tinderbox failure with Traceback (most recent call last): File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 263, in iterfind selector = _cache[cache_key] KeyError: ('%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s= "Filter"]/group[@%(name)s="Microsoft"]/group[@{http://openoffice.org/2001/registry} name="Import"]/prop', None) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tinderbox/buildslave/source/libo-master/android/mobile-config.py", line 85, in <module> props = root.findall(microsoftImport) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 304, in findall return list(iterfind(elem, path, namespaces)) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 277, in iterfind selector.append(ops[token[0]](next, token)) KeyError: '(' Change-Id: I34a770a342417fcbfb9689e3adc4b495d5bd5fe5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136282 Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> diff --git a/android/mobile-config.py b/android/mobile-config.py index 596f27f107a8..5998e5d1f9b7 100755 --- a/android/mobile-config.py +++ b/android/mobile-config.py @@ -14,13 +14,13 @@ # already over-complicated by rampant conditionals. import sys -import xml.etree.ElementTree as ElementTree +import xml.etree.ElementTree as ET main_xcd_discard = [ - 'org.openoffice.Office/TableWizard', # huge + 'org.openoffice.Office/TableWizard', # huge - 'org.openoffice.Office.DataAccess/Drivers', # no database - 'org.openoffice.Office/Addons', # no addons + 'org.openoffice.Office.DataAccess/Drivers', # no database + 'org.openoffice.Office/Addons', # no addons # no conventional UI; reverse sorted by size 'org.openoffice.Office.UI/GenericCommands', @@ -46,15 +46,15 @@ main_xcd_discard = [ 'org.openoffice.Office.UI/GlobalSettings', 'org.openoffice.Office.UI/BibliographyWindowState', 'org.openoffice.Office.UI/Category', -] + ] if __name__ == '__main__': - tree = ElementTree.parse(sys.argv[1]) + tree = ET.parse(sys.argv[1]) root = tree.getroot() total = 0 for child in root: - total += len(ElementTree.tostring(child)) + total += len(ET.tostring(child)) saved = 0 to_remove = [] @@ -62,7 +62,7 @@ if __name__ == '__main__': for child in root: section = child.attrib['{http://openoffice.org/2001/registry}name'] package = child.attrib['{http://openoffice.org/2001/registry}package'] - size = len(ElementTree.tostring(child)) + size = len(ET.tostring(child)); key = '%s/%s' % (package, section) if key in main_xcd_discard: print('removed %s - saving %d' % (key, size)) @@ -72,7 +72,7 @@ if __name__ == '__main__': for child in to_remove: root.remove(child) - print("saved %d of %d bytes: %2.f%%" % (saved, total, saved * 100.0 / total)) + print("saved %d of %d bytes: %2.f%%" % (saved, total, saved*100.0/total)) # Don't do pointless Word -> Writer and similar conversions when we have no UI. nsDict = { @@ -80,37 +80,28 @@ if __name__ == '__main__': "component-data": "{http://openoffice.org/2001/registry}component-data", "name": "{http://openoffice.org/2001/registry}name", } - microsoftImport = '%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s="Filter"]/group[@%(' +\ - 'name)s="Microsoft"]/group[@%(name)s="Import"]/prop' % nsDict + microsoftImport = '%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s="Filter"]/group[@%(name)s="Microsoft"]/group[@%(name)s="Import"]/prop' % nsDict props = root.findall(microsoftImport) for prop in props: prop.findall("value")[0].text = "false" # Disable View -> Text Boundaries - for prop in root.findall( - '%(component-schema)s[@%(name)s="UI"]/templates/group[@%(name)s="ColorScheme"]/group[@%(' + - 'name)s="DocBoundaries"]/prop' % nsDict): + for prop in root.findall('%(component-schema)s[@%(name)s="UI"]/templates/group[@%(name)s="ColorScheme"]/group[@%(name)s="DocBoundaries"]/prop' % nsDict): for value in prop.findall("value"): value.text = "false" # Disable Table -> Table Boundaries - for prop in root.findall( - '%(component-schema)s[@%(name)s="UI"]/templates/group[@%(name)s="ColorScheme"]/group[@%(' + - 'name)s="TableBoundaries"]/prop' % nsDict): + for prop in root.findall('%(component-schema)s[@%(name)s="UI"]/templates/group[@%(name)s="ColorScheme"]/group[@%(name)s="TableBoundaries"]/prop' % nsDict): for value in prop.findall("value"): value.text = "false" # Disable follow link with Ctrl+Click, use Click only for mobile app. - for prop in root.findall( - '%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s="Security"]/group[@%(' + - 'name)s="Scripting"]/prop[@%(name)s="HyperlinksWithCtrlClick"]' % nsDict): + for prop in root.findall('%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s="Security"]/group[@%(name)s="Scripting"]/prop[@%(name)s="HyperlinksWithCtrlClick"]' % nsDict): for value in prop.findall("value"): value.text = "false" # Disable Impress View -> Slide Pane - for prop in root.findall( - '%(component-data)s[@%(name)s="Impress"]/node[@%(name)s="MultiPaneGUI"]/node[@%(' + - 'name)s="SlideSorterBar"]/node[@%(name)s="Visible"]/prop[@%(name)s="ImpressView"]' % nsDict): + for prop in root.findall('%(component-data)s[@%(name)s="Impress"]/node[@%(name)s="MultiPaneGUI"]/node[@%(name)s="SlideSorterBar"]/node[@%(name)s="Visible"]/prop[@%(name)s="ImpressView"]' % nsDict): for value in prop.findall("value"): value.text = "false"