|  | 
| 1 |  | -VERSION:=$(shell python setup.py --version) | 
|  | 1 | +VERSION := $(shell python setup.py --version) | 
|  | 2 | + | 
|  | 3 | +CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx') | 
|  | 4 | + | 
|  | 5 | +CYTHON_DIRECTIVES = | 
|  | 6 | + | 
|  | 7 | +ifdef DEPENDENCY_INJECTOR_DEBUG_MODE | 
|  | 8 | +CYTHON_DIRECTIVES += -Xprofile=True | 
|  | 9 | +CYTHON_DIRECTIVES += -Xlinetrace=True | 
|  | 10 | +endif | 
|  | 11 | + | 
| 2 | 12 | 
 | 
| 3 | 13 | clean: | 
| 4 | 14 | # Clean sources | 
| 5 |  | -find dependency_injector -name '*.py[co]' -delete | 
| 6 |  | -find dependency_injector -name '__pycache__' -delete | 
| 7 |  | -find dependency_injector -name '*.c' -delete | 
| 8 |  | -find dependency_injector -name '*.so' -delete | 
|  | 15 | +find src -name '*.py[cod]' -delete | 
|  | 16 | +find src -name '__pycache__' -delete | 
|  | 17 | +find src -name '*.c' -delete | 
|  | 18 | +find src -name '*.so' -delete | 
|  | 19 | +find src -name '*.html' -delete | 
| 9 | 20 | # Clean tests | 
| 10 | 21 | find tests -name '*.py[co]' -delete | 
| 11 | 22 | find tests -name '__pycache__' -delete | 
| 12 | 23 | # Clean examples | 
| 13 | 24 | find examples -name '*.py[co]' -delete | 
| 14 | 25 | find examples -name '__pycache__' -delete | 
| 15 | 26 | 
 | 
| 16 |  | -tests: clean | 
|  | 27 | +cythonize: | 
|  | 28 | +# Compile Cython to C | 
|  | 29 | +cython -a $(CYTHON_DIRECTIVES) $(CYTHON_SRC) | 
|  | 30 | +# Move all Cython html reports | 
|  | 31 | +mkdir -p reports/cython/ | 
|  | 32 | +find src -name '*.html' -exec mv {} reports/cython/ \; | 
|  | 33 | + | 
|  | 34 | +build: clean cythonize | 
|  | 35 | +# Compile C extensions | 
|  | 36 | +python setup.py build_ext --inplace | 
|  | 37 | + | 
|  | 38 | +install: uninstall clean cythonize | 
|  | 39 | +pip install -ve . | 
|  | 40 | + | 
|  | 41 | +uninstall: | 
|  | 42 | +- pip uninstall -y -q dependency-injector 2> /dev/null | 
|  | 43 | + | 
|  | 44 | +test: build | 
| 17 | 45 | # Unit tests with coverage report | 
| 18 | 46 | coverage erase | 
| 19 |  | -coverage run --rcfile=./.coveragerc -m unittest2 discover tests | 
|  | 47 | +coverage run --rcfile=./.coveragerc -m unittest2 discover tests/unit | 
| 20 | 48 | coverage report --rcfile=./.coveragerc | 
| 21 | 49 | coverage html --rcfile=./.coveragerc | 
| 22 |  | -coverage erase | 
|  | 50 | + | 
|  | 51 | +check: | 
| 23 | 52 | # Static analysis | 
| 24 |  | -flake8 --max-complexity=10 dependency_injector/ | 
|  | 53 | +flake8 --max-complexity=10 src/dependency_injector/ | 
| 25 | 54 | flake8 --max-complexity=10 examples/ | 
| 26 | 55 | # Code style analysis | 
| 27 |  | -pydocstyle dependency_injector/ | 
|  | 56 | +pydocstyle src/dependency_injector/ | 
| 28 | 57 | pydocstyle examples/ | 
| 29 | 58 | 
 | 
| 30 |  | -publish: clean | 
|  | 59 | +publish: cythonize | 
| 31 | 60 | # Create and upload build | 
| 32 | 61 | python setup.py sdist upload | 
| 33 | 62 | # Create and upload tag | 
|  | 
0 commit comments