Tune building in debug mode

This commit is contained in:
Roman Mogilatov 2016-11-02 17:21:40 +02:00
parent d8f44948a4
commit 3bd19a168a
4 changed files with 17 additions and 9 deletions

View File

@ -3,13 +3,13 @@ language: python
install:
- pip install tox
- pip install cython
- make build
- make cythonize
script:
- tox
python:
- 3.5
env:
- TOXENV=coveralls DEBUG=1
- TOXENV=coveralls DEPENDENCY_INJECTOR_DEBUG_MODE=1
- TOXENV=pylint
- TOXENV=flake8
- TOXENV=pydocstyle

View File

@ -5,9 +5,8 @@ CYTHON_SRC := $(shell find dependency_injector -name '*.pyx')
CYTHON_DIRECTIVES =
C_MACROS =
ifdef DEBUG
ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
CYTHON_DIRECTIVES += -Xprofile=True -Xlinetrace=True
C_MACROS += -DCYTHON_TRACE
endif
@ -34,7 +33,7 @@ cythonize:
build: clean cythonize
# Compile C extensions
python setup.py build_ext --inplace $(C_MACROS)
python setup.py build_ext --inplace
test:
# Unit tests with coverage report

View File

@ -1,5 +1,6 @@
"""`Dependency injector` setup script."""
import os
import re
from setuptools import setup, Extension
@ -17,6 +18,13 @@ with open('requirements.txt') as version:
with open('dependency_injector/__init__.py') as init_file:
version = re.search('VERSION = \'(.*?)\'', init_file.read()).group(1)
# Defining macros:
defined_macros = list()
if os.environ.get('DEPENDENCY_INJECTOR_DEBUG_MODE') == '1':
defined_macros.append(('CYTHON_TRACE', 1))
defined_macros.append(('CYTHON_TRACE_NOGIL', 1))
print(defined_macros)
setup(name='dependency-injector',
version=version,
@ -36,6 +44,7 @@ setup(name='dependency-injector',
ext_modules=[
Extension('dependency_injector.injections',
['dependency_injector/injections.c'],
define_macros=defined_macros,
extra_compile_args=['-O2']),
],
package_data={

View File

@ -18,18 +18,18 @@ deps=
coveralls
commands=
coverage erase
coverage run --rcfile=./.coveragerc -m unittest2 discover tests []
coverage run --rcfile=./.coveragerc -m unittest2 discover tests
coveralls
[testenv:pylint]
basepython=python2.7
basepython=python3.5
deps=
pylint
commands=
- pylint -f colorized --rcfile=./.pylintrc dependency_injector
[testenv:flake8]
basepython=python2.7
basepython=python3.5
deps=
flake8
commands=
@ -37,7 +37,7 @@ commands=
flake8 --max-complexity=10 examples/
[testenv:pydocstyle]
basepython=python2.7
basepython=python3.5
deps=
pydocstyle
commands=