-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
186 lines (149 loc) · 5.06 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
.PHONY: clean-pyc clean-build clean-docs docs docs-pdf
# You can set these variables from the command line.
# N: Package Name
N = textblob_de
# M: git commit message
M =
# P: Python executable
P = python
# O: Platform specific 'open' command
# Linux 'open' or 'xdg-open' / OSX: 'open' / Win: 'start'
#O = start
#O = xdg-open
O = open
help:
@echo ""
@echo "Please use 'make <target>' where where <target> is one of"
@echo ""
@echo "SETUP & CLEAN"
@echo "-------------"
@echo ""
@echo "install run 'python setup.py install'"
@echo "uninstall run 'pip uninstall <package>'"
@echo "develop install links to source files in current Python environment"
@echo "reset-dev uninstall all links and console scripts and make clean"
@echo "clean remove all artifacts"
@echo "clean-build remove build artifacts"
@echo "clean-docs remove documentation build artifacts"
@echo "clean-pyc remove Python file artifacts (except in 'ext')"
@echo "clean-test remove test artifacts (e.g. 'htmlcov')"
@echo "clean-logs remove log artifacts and place empty file in 'log_dir'"
@echo ""
@echo "TESTING"
@echo "-------"
@echo ""
@echo "autopep8 automatically correct 'pep8' violations"
@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 ""
@echo "PUBLISHING"
@echo "----------"
@echo ""
@echo "docs generate Sphinx HTML documentation, including API docs"
@echo "docs-pdf generate Sphinx HTML and PDF documentation, including API docs"
@echo "sdist package"
@echo "publish package and upload sdist and universal wheel to PyPI"
@echo "publish-test package and upload sdist and universal wheel to TestPyPI"
@echo "register update README.rst on PyPI"
@echo "push-github push all changes to git repository on github.com"
@echo "push-bitbucket push all changes to git repository on bitbucket.org"
@echo " --> include commit message as M='your message'"
@echo ""
@echo "VARIABLES ACCESSIBLE FROM COMMAND-LINE"
@echo "--------------------------------------"
@echo ""
@echo "M='your message' mandatory git commit message"
@echo "N='package name' specify python package name (optional)"
@echo "O='open|xdg-open|start'"
@echo " --> specify platform specific 'open' cmd (optional)"
@echo "P='path/to/python' specify python executable (optional)"
@echo ""
clean: clean-build clean-pyc clean-test clean-logs clean-docs
find . -name '.DS_Store' -exec rm -f {} +
clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-docs:
make -C ./docs/src clean
rm -f docs/src/apidoc/$(N).rst
rm -f docs/src/apidoc/modules.rst
clean-pyc:
find . -name '__pycache__' -exec rm -fr {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
clean-test:
rm -fr htmlcov/
rm -fr .tox/
rm -fr *.egg
rm -f .coverage
clean-logs:
find . -maxdepth 4 -name '*.log' -exec rm -f {} +
find . -maxdepth 4 -name '*.log.[1-6]' -exec rm -f {} +
install:
pip install -r requirements.txt
$(P) setup.py install
uninstall:
pip uninstall $(N)
reset-dev: uninstall clean reset-env clean-logs
reset-env:
find . -name '.python-version' -exec rm -f {} +
develop: clean prepare_dev prepare_tests
$(P) setup.py develop
prepare_dev:
pip install -U -r requirements-dev.txt
pip install -r requirements.txt
prepare_tests:
pip install -U -r requirements-tests.txt
autopep8: develop
autopep8 -v -i -a -a *.py
autopep8 -v -i -a -a tests/*.py
autopep8 -v -i -a -a $(N)/*.py
docformatter -i *.py
docformatter -i tests/*.py
docformatter -i $(N)/*.py
lint: autopep8
flake8
test: develop
$(P) run_tests.py
test-all: develop
tox
coverage: develop
coverage run --source $(N) run_tests.py
coverage report -m
coverage html
$(O) ./htmlcov/index.html &
docs: clean develop
$(P) prepare_docs.py
#sphinx-apidoc -P -f -o docs/src/apidoc $(N) # use api_reference.rst
make -C ./docs/src html
$(O) ./docs/html/index.html &
docs-pdf: docs
#make -C ./docs/src latexpdf
#$(O) ./docs/$(subst _,-,$(N)).pdf &
curl https://media.readthedocs.org/pdf/textblob-de/stable/textblob-de.pdf --output docs/textblob-de.pdf
publish: clean docs-pdf
$(P) setup.py publish
$(O) https://pypi.python.org/pypi/$(subst _,-,$(N)) &
publish-test: clean docs-pdf
$(P) setup.py publish_test
$(O) https://test.pypi.org/project/$(subst _,-,$(N)) &
sdist: clean docs-pdf
$(P) setup.py sdist
ls -l dist
register:
$(P) setup.py register
$(O) https://pypi.python.org/pypi/$(subst _,-,$(N)) &
push-bitbucket: clean
git add --all
git commit -a -m "$(M)"
git push -u origin --all
$(O) https://bitbucket.org/mki5600/$(subst _,-,$(N)) &
push-github: clean
git add --all
git commit -a -m "$(M)"
git push -u origin --all
$(O) https://github.com/markuskiller/$(subst _,-,$(N)) &