Only install pre-commit in setup-development-environment

add-more-languages
Meng Zhang 2023-03-29 17:04:10 +08:00
parent 477ef83319
commit a5afed584f
1 changed files with 6 additions and 2 deletions

View File

@ -1,14 +1,18 @@
POETRY_EXISTS := $(shell which poetry &> /dev/null) POETRY_EXISTS := $(shell which poetry &> /dev/null)
PRE_COMMIT_EXISTS := $(shell poetry run which pre-commit &> /dev/null)
PRE_COMMIT_HOOK := .git/hooks/pre-commit PRE_COMMIT_HOOK := .git/hooks/pre-commit
pre-commit: pre-commit: setup-development-environment
poetry run pre-commit poetry run pre-commit
install-poetry: install-poetry:
ifndef POETRY_EXISTS ifndef POETRY_EXISTS
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.4.0 python3 - curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.4.0 python3 -
endif endif
poetry install
ifndef PRE_COMMIT_EXISTS
poetry run pip install $(shell poetry export --without-hashes --with dev | grep pre-commit | cut -d";" -f1)
endif
$(PRE_COMMIT_HOOK): $(PRE_COMMIT_HOOK):
poetry run pre-commit install --install-hooks poetry run pre-commit install --install-hooks