Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 # Automation of common development operations. | |
Sebastian Noack
2016/03/14 11:16:01
A makefile, doesn't seem appropriate for a Python
Vasily Kuznetsov
2016/03/14 12:04:29
The makefile is not necessary to build or install
Sebastian Noack
2016/03/14 12:19:22
Flask and Requests aren't the best examples for be
Vasily Kuznetsov
2016/03/14 17:20:41
Ok, let me try to implement the same functionality
| |
2 | |
3 .PHONY: devenv clean install uninstall test testcov htmlcov | |
4 | |
5 PACKAGE=python_abp | |
6 MODULE=abp | |
7 DEVENV=__ | |
8 TESTS=tests | |
9 | |
10 PYTHON=${DEVENV}/bin/python | |
11 PIP=${DEVENV}/bin/pip | |
12 PYTEST=${DEVENV}/bin/py.test | |
13 TOX=${DEVENV}/bin/tox | |
14 | |
15 help: | |
16 @echo | |
17 @echo "This makefile automates common development operations." | |
18 @echo | |
19 @echo " Usage: make <target>" | |
20 @echo | |
21 @echo "Where target is one of:" | |
22 @echo | |
23 @echo " devenv -- Create development environment" | |
24 @echo " test -- Run the tests with default version of python" | |
25 @echo " testcov -- Output test coverage report to console" | |
26 @echo " htmlcov -- Generate test coverage report in HTML" | |
27 @echo " testall -- Run the tests with all supported python versio ns" | |
28 @echo " syntaxcheck -- Check syntax with flake8" | |
29 @echo " diffpep8 -- Find PEP8-non-compliance" | |
30 @echo " fixpep8 -- Fix PEP8-non-compliance (MIGHT CHANGE SOURCE)" | |
31 @echo " install -- Install module and script with default python" | |
32 @echo " uninstall -- Uninstall from default python" | |
33 @echo " clean -- Remove testing and build artifacts" | |
34 @echo | |
35 | |
36 devenv: ${DEVENV} | |
37 | |
38 ${DEVENV}: | |
39 virtualenv ${DEVENV} | |
40 ${PIP} install pytest pytest-cov tox flake8 autopep8 | |
41 ${PYTHON} setup.py develop | |
42 | |
43 test: ${DEVENV} | |
44 ${PYTEST} ${TESTS} | |
45 | |
46 testcov: ${DEVENV} | |
47 ${PYTEST} --cov=${MODULE} ${TESTS} | |
48 | |
49 htmlcov: ${DEVENV} | |
50 ${PYTEST} --cov-report=html --cov=${MODULE} ${TESTS} | |
51 | |
52 testall: ${DEVENV} | |
53 ${TOX} | |
54 | |
55 syntaxcheck: ${DEVENV} | |
56 ${DEVENV}/bin/flake8 ${MODULE} ${TESTS} | |
57 | |
58 diffpep8: ${DEVENV} | |
59 ${DEVENV}/bin/autopep8 --diff -r -aaa ${MODULE} ${TESTS} | |
60 | |
61 fixpep8: ${DEVENV} | |
62 ${DEVENV}/bin/autopep8 --in-place -r -aaa ${MODULE} ${TESTS} | |
63 | |
64 install: | |
65 python setup.py install | |
66 | |
67 uninstall: | |
68 pip uninstall -y ${PACKAGE} | |
69 | |
70 clean: | |
71 rm -Rf ${DEVENV} .coverage .cache .tox htmlcov ${PACKAGE}.egg-info\ | |
72 `find . -name *.pyc` build dist MANIFEST | |
OLD | NEW |