-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
111 lines (91 loc) · 2.92 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
# Makefile
APP=pyline
.PHONY: help clean-pyc clean-build docs clean test test-all coverage docs release dist twine docs_rsync_to_local docs_rebuild
help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "test-all - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "dist - package"
clean: clean-build clean-pyc
rm -fr htmlcov/
clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
lint:
flake8 '$(APP)' tests
test:
pytest -v ./tests/
test-coverage:
pytest -v --cov=pyline --cov-report=term-missing ./tests/
test-all:
tox
coverage:
coverage run --source '$(APP)' setup.py test
coverage report -m
coverage html
open htmlcov/index.html
docs:
rm -f docs/$(APP).rst
rm -f docs/modules.rst
sphinx-apidoc --no-toc -o docs/ '$(APP)'
$(MAKE) -C docs clean
$(MAKE) -C docs html
@#$(MAKE) open docs/_build/html/index.html
_setversion:
sed -i "s/version='\(.*\)'/version='$(version)'/g" ./setup.py
sed -i "s/^__version__ =\(.*\)$$/__version__ = '$(version)'/g" pyline/pyline.py
setversion:
@# Usage:
@# make setversion version=0.3.17
git diff --exit-code ./setup.py ./pyline/pyline.py && \
echo "ERROR: There are existing changes. Exiting." >&2 && false
$(MAKE) _setversion version=$(version)
git diff --exit-code ./setup.py pyline/pyline.py || true
git commit -m "RLS: setup.py, pyline.py: version=$(version)" \
setup.py pyline/pyline.py
release:
@# Usage:
@# make release version=0.3.17
# version=v0.3.17
## Start a new HubFlow release
git hf release start '$(version)'
## update version in setup.py and pyline.py
$(MAKE) setversion version=$(version)
## register with pypi
# python setup.py build register
## generate a source distribution and upload to pypi
#python setup.py bdist_wheel upload
$(MAKE) dist
git hf release finish '$(version)'
$(MAKE) twine
## create a new tagged release
# update http://github.com/westurner/pyline/releases
# browse to url, select version tag
# - [ ] click 'Edit release'
# - [ ] set the release title to "pyline v${ver}"
# - [ ] (optionally) paste the changelog into the release description
python -m webbrowser 'https://github.com/westurner/pyline/releases/edit/$(version)'
dist: clean
python setup.py sdist
python setup.py bdist_wheel
ls -l dist/*
dist-check:
twine check dist/*
twine: dist-check
# PyPI: https://pypi.org/account/login/
twine upload ./dist/*
docs_rsync_to_local:
rsync -avr ./docs/_build/html/ '$(_DOCSHTML)'/'$(APP)'
docs_rebuild:
$(MAKE) docs
$(MAKE) docs_rsync_to_local