Update format shell script for WSL compat#422
Update format shell script for WSL compat#422Phlosioneer wants to merge 1 commit intopret:masterfrom
Conversation
The script now looks for `clang-format-18`, which is needed for WSL Ubuntu, rather than the standard `clang-format`.
|
clang-format works fine for me in wsl |
|
Dang, that makes this tricky. I followed the instructions in the contributing guide; apt install clang-format on wsl Ubuntu installed version 10, while apt install clang-format-18 installed version 18. Let me see if I can add a --version check instead of just checking for executable existence. |
|
out of curiosity what version of wsl ubuntu do you have? |
|
WSL 2, Ubuntu 20.04.4 LTS |
|
yeah that would explain it.... have you considered updating to at least 24.04 |
|
I was able to update to 22, but 24 is giving me a lot of trouble during the upgrade. I figured a way to check --version, I'll commit and push after lunch. |
|
what clang-format version does 22 give you btw? |
|
14 |
|
Well this is unfortunate. Ubuntu 22 doesn't have an apt package for clang-format-18 or higher. Now I'm going to have to figure out how to finish the upgrade to 24... |
| set -e | ||
|
|
||
| find src include \( -name "*.c" -or -name "*.cpp" -or -name "*.h" -or -name "*.hpp" \) -exec clang-format -i --verbose {} + | ||
| if [ $(which clang-format-18) ]; then |
There was a problem hiding this comment.
| if [ $(which clang-format-18) ]; then | |
| if which clang-format-18 &>/dev/null; then |
or
| if [ $(which clang-format-18) ]; then | |
| if command -v clang-format-18 &>/dev/null; then |
|
|
||
| find src include \( -name "*.c" -or -name "*.cpp" -or -name "*.h" -or -name "*.hpp" \) -exec clang-format -i --verbose {} + | ||
| if [ $(which clang-format-18) ]; then | ||
| # WSL and old Ubuntu versions have clang-format frozen on version 10. We need at |
There was a problem hiding this comment.
or we can specify a minimum supported distro, or ask that users symlink clang-format-xxx to their PATH, eliminating the need to change this file
|
This pull request has had no activity for 60 days and will be marked stale. If there is no further activity, it will be closed in 30 days. |
The script now looks for
clang-format-18, which is needed for WSL Ubuntu, rather than the standardclang-format.