From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- ...emove_not_existent_files_from_clang_excludelist | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 solenv/clang-format/remove_not_existent_files_from_clang_excludelist (limited to 'solenv/clang-format/remove_not_existent_files_from_clang_excludelist') 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))) -- cgit v1.2.3