3 PYTHON ?
= /usr
/bin
/python2
5 UNITTEST2
= /usr
/bin
/unit2
8 PY_MODULE_BYTECODE_SUFFIX
= .pyc
9 package_modules
= $(shell find
${CURDIR}/dput
/ -name
'*${PY_MODULE_SUFFIX}')
10 python_modules
= $(shell find
${CURDIR}/ -name
'*${PY_MODULE_SUFFIX}')
13 GENERATED_FILES
+= $(patsubst \
14 %${PY_MODULE_SUFFIX},%${PY_MODULE_BYTECODE_SUFFIX}, \
17 UNITTEST_OPTS ?
= --buffer
19 PYTHON_COVERAGE
= $(PYTHON
) -m coverage
20 COVERAGE_RUN_OPTS ?
= --branch
21 COVERAGE_REPORT_OPTS ?
=
22 COVERAGE_TEXT_REPORT_OPTS ?
=
23 COVERAGE_HTML_REPORT_OPTS ?
=
32 $(RM
) -r
${GENERATED_FILES}
38 GENERATED_FILES
+= TAGS
40 TAGS
: ${python_modules}
41 etags
--output
"$@" --lang
=python
${python_modules}
45 test: test-unittest test-coverage
49 $(PYTHON
) -m unittest discover
${UNITTEST_OPTS}
52 test-coverage
: test-coverage-run test-coverage-html test-coverage-report
54 GENERATED_FILES
+= .coverage
56 .PHONY
: test-coverage-run
57 test-coverage-run
: coverage_opts
= ${COVERAGE_RUN_OPTS}
59 $(PYTHON
) -m coverage run
${coverage_opts} \
60 $(UNITTEST2
) discover
${UNITTEST_OPTS}
62 GENERATED_FILES
+= htmlcov
/
64 .PHONY
: test-coverage-html
65 test-coverage-html
: coverage_opts
= ${COVERAGE_REPORT_OPTS} ${COVERAGE_HTML_REPORT_OPTS}
67 $(PYTHON_COVERAGE
) html
${coverage_opts} ${package_modules}
69 .PHONY
: test-coverage-report
70 test-coverage-report
: coverage_opts
= ${COVERAGE_REPORT_OPTS} ${COVERAGE_TEXT_REPORT_OPTS}
72 $(PYTHON_COVERAGE
) report
${coverage_opts} ${package_modules}
79 # vim: fileencoding=utf-8 filetype=make :