diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /solenv/clang-format/remove_not_existent_files_from_clang_excludelist | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | solenv/clang-format/remove_not_existent_files_from_clang_excludelist | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/solenv/clang-format/remove_not_existent_files_from_clang_excludelist b/solenv/clang-format/remove_not_existent_files_from_clang_excludelist new file mode 100755 index 000000000..89380381c --- /dev/null +++ b/solenv/clang-format/remove_not_existent_files_from_clang_excludelist @@ -0,0 +1,37 @@ +#!/usr/bin/python +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# Reformat files which are not excluded. This is interesting if the +# clang-format version or config changes. +# -n allows just listing the formatted files. + +import os + +base_path_to_core = os.path.abspath("../../") +excludelist = "solenv/clang-format/excludelist" + +def delete_line_in_excludelist(line_to_be_removed): + with open(os.path.join(base_path_to_core, excludelist), "r") as f: + lines = f.readlines() + with open(os.path.join(base_path_to_core, excludelist), "w") as f: + for line in lines: + if line.strip("\n") != line_to_be_removed: + f.write(line) + +f = open(os.path.join(base_path_to_core, excludelist), "r") +lines = f.read().split("\n") +f.close() +del lines[len(lines)-1] # remove empty, last line + +amount_lines_deleted = 0 + +for line in lines: + if not os.path.isfile(os.path.join(base_path_to_core, line)): + print("Deleting file {} in excludelist".format(line)) + delete_line_in_excludelist(line) + amount_lines_deleted += 1 + +print("Removed {} lines in {}".format(amount_lines_deleted, os.path.join(base_path_to_core, excludelist))) |