summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-02-02 12:12:02 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-02-02 14:51:18 +0100
commitd933dba2f1740c6289dd7650fdf249326978af56 (patch)
tree5087381c001635ae17f978646a4c3eae981c245b /bin
parent3b0a0e70cb67fc2e1f9999d2e8cbb9cfcd8c670e (diff)
flat-odf-cleanup: survive already missing settings/scripts
If they are already removed, just don't do anything. Change-Id: I3ef09ea5de8841820d586b41ed6c86e78bd06b9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129326 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'bin')
-rw-r--r--bin/flat-odf-cleanup.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/flat-odf-cleanup.py b/bin/flat-odf-cleanup.py
index d9a3f000db28..8311b1f93960 100644
--- a/bin/flat-odf-cleanup.py
+++ b/bin/flat-odf-cleanup.py
@@ -225,10 +225,14 @@ def remove_unused(root):
root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}font-face-decls").remove(font)
# remove office:settings
- root.remove(root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}settings"))
+ settings = root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}settings")
+ if settings:
+ root.remove(settings)
# scripts are almost never needed
- root.remove(root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}scripts"))
+ scripts = root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}scripts")
+ if scripts:
+ root.remove(scripts)
# TODO: remove rsid attributes
# TODO: replace embedded image with some tiny one