diff --git a/bin/util/remove_clutter_after_last_endif.py b/bin/util/remove_clutter_after_last_endif.py new file mode 100644 index 0000000000000000000000000000000000000000..8cbdd81e6556e4cb3b871b8f017aa7520d98eaaf --- /dev/null +++ b/bin/util/remove_clutter_after_last_endif.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 +import os + +# replace everything after last #endif with new line +def clearAfterLastEndIf(filename): + with open(filename, 'r') as header: + split = header.read().split("#endif") + split[-1] = '\n' + with open(filename, 'w') as header: + header.write("#endif".join(split)) + +for root, _, files in os.walk(os.getcwd()): + for file in files: + if file.endswith(".hh"): + clearAfterLastEndIf(os.path.join(root, file))