-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
49 lines (36 loc) · 1.33 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
# Inspired by https://github.com/archlinux/arch-security-tracker/blob/master/Makefile
PYTHON?=python
PYLINT?=pylint
PYTEST?=py.test
PYTEST_OPTIONS+=-s
PYTEST_INPUT?=test
PYTEST_COVERAGE_OPTIONS+=--cov-report=term-missing --cov-report=html:test/coverage --cov=pycman
EXT_COVERAGE_DIR=test/ext-coverage
PY_VERSION=$(shell ${PYTHON} -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))")
BUILD_DIR=build/lib.linux-$(shell uname -m)-${PY_VERSION}
DOC_DIR=doc
.PHONY: test doc lint build
build:
$(PYTHON) setup.py build
test: test-py
test-py coverage:
PYTHONPATH=".:${BUILD_DIR}:${PYTHONPATH}" ${PYTEST} ${PYTEST_INPUT} ${PYTEST_OPTIONS} ${PYTEST_COVERAGE_OPTIONS}
open-coverage: coverage
${BROWSER} test/coverage/index.html
ext-coverage:
LDFLAGS="-fprofile-arcs -ftest-coverage" CFLAGS="-fprofile-arcs -ftest-coverage" python setup.py build
PYTHONPATH=".:${BUILD_DIR}:${PYTHONPATH}" ${PYTEST} ${PYTEST_INPUT} ${PYTEST_OPTIONS}
test -d ${EXT_COVERAGE_DIR} || mkdir ${EXT_COVERAGE_DIR}
gcovr -r . --html -o ${EXT_COVERAGE_DIR}/index.html --html-details --html-title="pyalpm C coverage"
open-ext-coverage: ext-coverage
${BROWSER} ${EXT_COVERAGE_DIR}/index.html
doc:
make -C ${DOC_DIR} html
open-doc: doc
${BROWSER} ${DOC_DIR}/_build/html/index.html
lint:
$(PYLINT) pycman
.PHONY: clean
clean:
-rm -r build
make -C ${DOC_DIR} clean