python-dependency-injector/Makefile

47 lines
1.3 KiB
Makefile
Raw Normal View History

2016-10-30 15:41:33 +03:00
VERSION:=$(shell python setup.py --version)
2016-10-31 00:59:42 +03:00
clean:
# Clean sources
2016-10-31 12:30:57 +03:00
find dependency_injector -name '*.py[cod]' -delete
2016-10-31 00:59:42 +03:00
find dependency_injector -name '__pycache__' -delete
find dependency_injector -name '*.c' -delete
find dependency_injector -name '*.so' -delete
# Clean tests
find tests -name '*.py[co]' -delete
find tests -name '__pycache__' -delete
# Clean examples
find examples -name '*.py[co]' -delete
find examples -name '__pycache__' -delete
2016-10-31 12:30:57 +03:00
compile: clean
# Compile Cython to C
cython -a dependency_injector/injections.pyx
# Move all Cython html reports
mkdir -p reports/cython/
find dependency_injector -name '*.html' -exec mv {} reports/cython/ \;
build: compile
# Compile C extensions
python setup.py build_ext --inplace
tests: build
2016-10-31 00:59:42 +03:00
# 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
# Static analysis
flake8 --max-complexity=10 dependency_injector/
flake8 --max-complexity=10 examples/
# Code style analysis
pydocstyle dependency_injector/
pydocstyle examples/
2016-10-31 12:30:57 +03:00
publish: build tests
2016-10-31 00:59:42 +03:00
# Create and upload build
2016-10-30 15:41:33 +03:00
python setup.py sdist upload
2016-10-31 00:59:42 +03:00
# Create and upload tag
2016-10-30 15:41:33 +03:00
git tag -a $(VERSION) -m 'version $(VERSION)'
git push --tags