Add creation of debug builds

This commit is contained in:
Roman Mogilatov 2016-11-01 10:49:44 +02:00
parent 02b993ec54
commit e5498f214b
4 changed files with 24 additions and 10 deletions

View File

@ -1,6 +1,6 @@
[run]
plugins = Cython.Coverage
include = dependency_injector/*
omit = tests/*
[html]
directory=reports/unittests/

View File

@ -3,7 +3,7 @@ language: python
install:
- pip install tox
- pip install cython
- make compile
- make build DEBUG=1
script:
- tox
python:

View File

@ -1,11 +1,23 @@
VERSION := $(shell python setup.py --version)
CYTHON_SRC := $(shell find dependency_injector -name '*.pyx')
CYTHON_DIRECTIVES =
C_MACROS =
ifdef DEBUG
CYTHON_DIRECTIVES += -Xprofile=True -Xlinetrace=True
C_MACROS += -DCYTHON_TRACE
endif
clean:
# Clean sources
find dependency_injector -name '*.py[cod]' -delete
find dependency_injector -name '__pycache__' -delete
find dependency_injector -name '*.c' -delete
find dependency_injector -name '*.so' -delete
find dependency_injector -name '*.html' -delete
# Clean tests
find tests -name '*.py[co]' -delete
find tests -name '__pycache__' -delete
@ -13,24 +25,25 @@ clean:
find examples -name '*.py[co]' -delete
find examples -name '__pycache__' -delete
compile: clean
cythonize:
# Compile Cython to C
cython -a dependency_injector/injections.pyx
cython -a $(CYTHON_DIRECTIVES) $(CYTHON_SRC)
# Move all Cython html reports
mkdir -p reports/cython/
find dependency_injector -name '*.html' -exec mv {} reports/cython/ \;
build: compile
build: clean cythonize
# Compile C extensions
python setup.py build_ext --inplace
python setup.py build_ext --inplace $(C_MACROS)
tests: build
test:
# Unit tests with coverage report
coverage erase
coverage run --rcfile=./.coveragerc -m unittest2 discover tests
coverage report --rcfile=./.coveragerc
coverage html --rcfile=./.coveragerc
coverage erase
check:
# Static analysis
flake8 --max-complexity=10 dependency_injector/
flake8 --max-complexity=10 examples/
@ -38,7 +51,7 @@ tests: build
pydocstyle dependency_injector/
pydocstyle examples/
publish: build tests
publish: cythonize
# Create and upload build
python setup.py sdist upload
# Create and upload tag

View File

@ -13,6 +13,7 @@ basepython=python2.7
passenv=TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps=
{[testenv]deps}
cython
coverage
coveralls
commands=