-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
121 lines (98 loc) · 2.34 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Makefile for Python Wechaty
#
# GitHb: https://github.com/wechaty/python-wechaty
# Author: Huan LI <zixia@zixia.net> git.io/zixia
#
SOURCE_GLOB=$(wildcard bin/*.py src/wechaty_puppet_itchat/puppet.py tests/**/*.py)
#
# Huan(202003)
# F811: https://github.com/PyCQA/pyflakes/issues/320#issuecomment-469337000
#
IGNORE_PEP=E203,E221,E241,E272,E501,F811
# help scripts to find the right place of wechaty module
export PYTHONPATH=src/
.PHONY: all
all : clean lint
.PHONY: clean
clean:
rm -fr dist/*
.PHONY: lint
lint: pylint pycodestyle flake8 mypy pytype
.PHONY: pylint
pylint:
pylint \
--load-plugins pylint_quotes \
--disable E0401,W0511,W1203,C0302 \
$(SOURCE_GLOB)
.PHONY: pycodestyle
pycodestyle:
pycodestyle \
--statistics \
--count \
--ignore="${IGNORE_PEP}" \
$(SOURCE_GLOB)
.PHONY: flake8
flake8:
flake8 \
--ignore="${IGNORE_PEP}" \
$(SOURCE_GLOB)
.PHONY: mypy
mypy:
MYPYPATH=stubs/ mypy \
$(SOURCE_GLOB)
.PHONE: pytype
pytype:
pytype \
--disable=import-error,pyi-error \
src/wechaty_puppet_itchat/puppet.py
.PHONY: uninstall-git-hook
uninstall-git-hook:
pre-commit clean
pre-commit gc
pre-commit uninstall
pre-commit uninstall --hook-type pre-push
.PHONY: install-git-hook
install-git-hook:
# cleanup existing pre-commit configuration (if any)
pre-commit clean
pre-commit gc
# setup pre-commit
# Ensures pre-commit hooks point to latest versions
pre-commit autoupdate
pre-commit install
pre-commit install --overwrite --hook-type pre-push
.PHONY: install
install:
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
# install pre-commit related hook scripts
$(MAKE) install-git-hook
.PHONY: pytest
pytest:
python3 -m pytest src/ tests/ -sv
.PHONY: test-unit
test-unit: pytest
.PHONY: test
test: lint pytest
code:
code .
.PHONY: run
run:
python3 bin/run.py
.PHONY: dist
dist:
python3 setup.py sdist bdist_wheel
.PHONY: publish
publish:
PATH=~/.local/bin:${PATH} twine upload dist/*
.PHONY: version
version:
@newVersion=$$(awk -F. '{print $$1"."$$2"."$$3+1}' < VERSION) \
&& echo $${newVersion} > VERSION \
&& git add VERSION \
&& git commit -m "🔥 update version to $${newVersion}" > /dev/null \
&& git tag "v$${newVersion}" \
&& echo "Bumped version to $${newVersion}"
.PHONY: deploy-version
deploy-version:
echo "VERSION = '$$(cat VERSION)'" > src/wechaty_puppet_itchat/version.py