From 899efc4cc308f25f0aeb6d2bcf1c61237035c08b Mon Sep 17 00:00:00 2001 From: Sing_chan <51314274+betterpig@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:07:45 +0800 Subject: [PATCH] optimize installation and instruction of clang-format (#43248) --- tools/codestyle/clang_format.hook | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/codestyle/clang_format.hook b/tools/codestyle/clang_format.hook index 72608fd8b83..79a0a542ebc 100755 --- a/tools/codestyle/clang_format.hook +++ b/tools/codestyle/clang_format.hook @@ -5,7 +5,15 @@ readonly VERSION="13.0.0" version=$(clang-format -version) +if ! [[ $(python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}') -ge 36 ]]; then + echo "clang-format installation by pip need python version great equal 3.6, + please change the default python to higher version." + exit 1 +fi + if ! [[ $version == *"$VERSION"* ]]; then + # low version of pip may not have the source of clang-format whl + pip install --upgrade pip pip install clang-format==13.0.0 fi -- GitLab