-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (49 loc) · 1.51 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.PHONY: install hooks lint install test fix clean help
PLATFORM?=local
TMP_HOOKS:=/tmp/.chessdb_lib_hooks_empty.target
VERSION:=src/chessdb_lib/version.py
.DEFAULT:help
help:
@printf "The following commands are available:\n\n"
@printf "\e[92m%s\e[0m\n" "make hooks"
@echo " - setup pre-commit hooks"
@printf "\e[92m%s\e[0m\n" "make test"
@echo " - run tests"
@printf "\e[92m%s\e[0m\n" "make lint"
@echo " - Autoformats code and sorts imports (unless running as 'ci')."
@printf "\e[92m%s\e[0m\n" "make run"
@echo " - runs chessdb_lib"
${VERSION}:
@echo "__version__ = \"$(shell git describe --always)\"" > ${VERSION}
hooks:${TMP_HOOKS}
${TMP_HOOKS}:.pre-commit-config.yaml
@pip install pre-commit > /dev/null
@pre-commit install > /dev/null
@pre-commit run --all-files || \
(printf "\e[93m%s\e[0m\n" "Run same make target again";exit 1)
@printf "\e[92m%s\e[0m\n" "Pre-commit hooks ran successfully"
@touch /tmp/.chessdb_lib_hooks_empty_target
lint:
@pip install yapf pylint 'isort<5.0'
@yapf --style google -dpr src tests
@pylint --rcfile=setup.cfg -r n src tests > pylint.txt
install: ${VERSION}
@python3 setup.py develop
test: install
@python3 setup.py test
fix: hooks
@pip install yapf pylint 'isort<5.0'
@isort --recursive src tests
@yapf --style google -ipr src tests
@pylint --rcfile=setup.cfg src tests
clean:
@find src tests | grep -E "(__pycache__|\.pyc)" | xargs rm -rf
@rm -rf \
src/chessdb_lib.egg-info/ \
.eggs/ \
.coverage \
htmlcov/ \
dist/ \
build/ \
coverage.xml \
pylint.txt