2017-12-15 17:21:15 +00:00
|
|
|
# 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
|
2017-12-16 15:19:47 +00:00
|
|
|
.PHONY: docs
|
2017-12-15 17:21:15 +00:00
|
|
|
|
|
|
|
help:
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32minit\033[0m"
|
2017-12-16 15:19:47 +00:00
|
|
|
@echo " Init environment for pydu."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mtest\033[0m"
|
2017-12-15 17:21:15 +00:00
|
|
|
@echo " Run pytest with Python 2 and 3."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mtest-py2\033[0m"
|
2017-12-15 17:21:15 +00:00
|
|
|
@echo " Run pytest with Python 2."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mtest-py3\033[0m"
|
2017-12-15 17:21:15 +00:00
|
|
|
@echo " Run pytest with Python 3."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mcoverage\033[0m"
|
2017-12-16 15:19:47 +00:00
|
|
|
@echo " Run pytest and report coverage."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mpublish\033[0m"
|
2017-12-16 15:28:13 +00:00
|
|
|
@echo " Publish pydu to PyPI."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mdocs\033[0m"
|
2017-12-16 15:19:47 +00:00
|
|
|
@echo " Make docs for pydu."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mclean\033[0m"
|
2017-12-15 17:21:15 +00:00
|
|
|
@echo " Remove python and build artifacts."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mclean-pyc\033[0m"
|
2017-12-15 17:21:15 +00:00
|
|
|
@echo " Remove python artifacts."
|
2017-12-16 15:29:57 +00:00
|
|
|
@echo "\033[32mclean-build\033[0m"
|
2017-12-15 17:21:15 +00:00
|
|
|
@echo " Remove build artifacts."
|
|
|
|
|
2017-12-16 15:19:47 +00:00
|
|
|
init:
|
|
|
|
pip install -r requirements-dev.txt
|
2018-12-10 13:29:16 +00:00
|
|
|
npm i docsify-cli -g
|
2017-12-16 15:19:47 +00:00
|
|
|
|
2017-12-15 17:21:15 +00:00
|
|
|
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)
|
|
|
|
|
2017-12-16 15:19:47 +00:00
|
|
|
coverage:
|
|
|
|
coverage run --source=pydu -m pytest tests
|
|
|
|
coverage report
|
|
|
|
|
2017-12-16 15:28:13 +00:00
|
|
|
publish:
|
|
|
|
pip install 'twine>=1.5.0'
|
|
|
|
python setup.py sdist
|
|
|
|
twine upload dist/*
|
2017-12-17 09:21:53 +00:00
|
|
|
rm -rf build dist *.egg-info .eggs
|
2017-12-16 15:28:13 +00:00
|
|
|
|
2017-12-16 15:19:47 +00:00
|
|
|
docs:
|
2018-12-10 13:29:16 +00:00
|
|
|
docsify serve docs
|
2017-12-16 15:19:47 +00:00
|
|
|
|
2017-12-15 17:21:15 +00:00
|
|
|
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:
|
2017-12-17 09:21:53 +00:00
|
|
|
rm -rf build dist *.egg-info .eggs
|