From 8b0dca9eabbe8e19ec1f6052503f2b38996efbf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Budiseli=C4=87?= Date: Sun, 26 Mar 2023 17:34:51 +0200 Subject: [PATCH] Upgrade pre-commit hook to use isort 5.12 (#840) --- .pre-commit-config.yaml | 6 +++--- init | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79bf689df..c75df7b98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,16 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.4.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort name: isort (python) diff --git a/init b/init index 95a2438eb..3a89013fb 100755 --- a/init +++ b/init @@ -106,15 +106,18 @@ for hook in $(find $DIR/.githooks -type f -printf "%f\n"); do echo "Added $hook hook" done; -# Install precommit hook -python3 -m pip install pre-commit -python3 -m pre_commit install - -# Install py format tools -echo "Install black formatter" -python3 -m pip install black==22.8.* -echo "Install isort" -python3 -m pip install isort==5.10.* +# Install precommit hook except on old operating systems because we don't +# develop on them -> pre-commit hook not required -> we can use latest +# packages. +if [ "${DISTRO}" != "centos-7" ] && [ "$DISTRO" != "debian-10" ] && [ "${DISTRO}" != "ubuntu-18.04" ]; then + python3 -m pip install pre-commit + python3 -m pre_commit install + # Install py format tools for usage during the development. + echo "Install black formatter" + python3 -m pip install black==23.1.* + echo "Install isort" + python3 -m pip install isort==5.12.* +fi # Link `include/mgp.py` with `release/mgp/mgp.py` ln -v -f include/mgp.py release/mgp/mgp.py