-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
67 lines (55 loc) · 1.62 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
# Env
export PYTHONDONTWRITEBYTECODE=1
TEST_PATH=./tests
DEFAULT_PYTHON2=`python -c "import sys;print(sys.version_info.major)" | grep 2`
PY2=$(if $(DEFAULT_PYTHON2),python,python2)
PY3=$(if $(DEFAULT_PYTHON2),python3,python)
# Func
.PHONY: docs
help:
@echo "\033[32minit\033[0m"
@echo " Init environment for pydu."
@echo "\033[32mtest\033[0m"
@echo " Run pytest with Python 2 and 3."
@echo "\033[32mtest-py2\033[0m"
@echo " Run pytest with Python 2."
@echo "\033[32mtest-py3\033[0m"
@echo " Run pytest with Python 3."
@echo "\033[32mcoverage\033[0m"
@echo " Run pytest and report coverage."
@echo "\033[32mpublish\033[0m"
@echo " Publish pydu to PyPI."
@echo "\033[32mdocs\033[0m"
@echo " Make docs for pydu."
@echo "\033[32mclean\033[0m"
@echo " Remove python and build artifacts."
@echo "\033[32mclean-pyc\033[0m"
@echo " Remove python artifacts."
@echo "\033[32mclean-build\033[0m"
@echo " Remove build artifacts."
init:
pip install -r requirements-dev.txt
npm i docsify-cli -g
test: test-py2 test-py3
test-py2: clean-pyc
$(PY2) -m pytest --color=yes $(TEST_PATH)
test-py3: clean-pyc
$(PY3) -m pytest --color=yes $(TEST_PATH)
coverage:
coverage run --source=pydu -m pytest tests
coverage report
publish:
pip install 'twine>=1.5.0'
python setup.py sdist
twine upload dist/*
rm -rf build dist *.egg-info .eggs
docs:
docsify serve docs
clean: clean-pyc clean-build
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -rf {} +
clean-build:
rm -rf build dist *.egg-info .eggs