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] [run]
plugins = Cython.Coverage
include = dependency_injector/* include = dependency_injector/*
omit = tests/*
[html] [html]
directory=reports/unittests/ directory=reports/unittests/

View File

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

View File

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

View File

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