Skip to content

install clang-format using pip, don't expect users to have the correct one

Mladen Ivkovic requested to merge pip_install_clang_format into master

Turns out one can install clang-format through pip, just like the python formatter black. This is surely a better way, as it doesn't require users to provide the correct version themselves, and is portable. I modified format.sh to install a specific version of clang-format now, and cleaned up and added additional checks for both format.sh and format_python.sh.

Usage of the scripts remains as-is. The option to override which clang-format exec to use via CLANG_FORMAT_CMD variable remains.

I successfully ran both formatting scripts on cosma after loading the python/3.10.1 module. It'll likely work with other python3 modules as well, but I didn't check.

I also switched to clang-format 16, because I can. It introduces very minimal changes (for commented out macros, it adds a space between the comment and the beginning of the macro). There's like 10-20 instances in 4-5 files. You might wanna run the formatting scripts immediately after merging this MR.

Merge request reports