python-dependency-injector/Makefile

59 lines
1.5 KiB
Makefile
Raw Normal View History

2016-11-01 08:49:44 +00:00
VERSION := $(shell python setup.py --version)
CYTHON_SRC := $(shell find dependency_injector -name '*.pyx')
CYTHON_DIRECTIVES =
C_MACROS =
2016-11-02 15:21:40 +00:00
ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
2016-11-01 08:49:44 +00:00
CYTHON_DIRECTIVES += -Xprofile=True -Xlinetrace=True
endif
2016-10-30 12:41:33 +00:00
2016-10-30 21:59:42 +00:00
clean:
# Clean sources
2016-10-31 09:30:57 +00:00
find dependency_injector -name '*.py[cod]' -delete
2016-10-30 21:59:42 +00:00
find dependency_injector -name '__pycache__' -delete
find dependency_injector -name '*.c' -delete
find dependency_injector -name '*.so' -delete
2016-11-01 08:49:44 +00:00
find dependency_injector -name '*.html' -delete
2016-10-30 21:59:42 +00:00
# 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-11-01 08:49:44 +00:00
cythonize:
2016-10-31 09:30:57 +00:00
# Compile Cython to C
2016-11-01 08:49:44 +00:00
cython -a $(CYTHON_DIRECTIVES) $(CYTHON_SRC)
2016-10-31 09:30:57 +00:00
# Move all Cython html reports
mkdir -p reports/cython/
find dependency_injector -name '*.html' -exec mv {} reports/cython/ \;
2016-11-01 08:49:44 +00:00
build: clean cythonize
2016-10-31 09:30:57 +00:00
# Compile C extensions
2016-11-02 15:21:40 +00:00
python setup.py build_ext --inplace
2016-10-31 09:30:57 +00:00
2016-11-01 08:49:44 +00:00
test:
2016-10-30 21:59:42 +00:00
# Unit tests with coverage report
coverage erase
coverage run --rcfile=./.coveragerc -m unittest2 discover tests
coverage report --rcfile=./.coveragerc
coverage html --rcfile=./.coveragerc
2016-11-01 08:49:44 +00:00
check:
2016-10-30 21:59:42 +00:00
# Static analysis
flake8 --max-complexity=10 dependency_injector/
flake8 --max-complexity=10 examples/
# Code style analysis
pydocstyle dependency_injector/
pydocstyle examples/
2016-11-01 08:49:44 +00:00
publish: cythonize
2016-10-30 21:59:42 +00:00
# Create and upload build
2016-10-30 12:41:33 +00:00
python setup.py sdist upload
2016-10-30 21:59:42 +00:00
# Create and upload tag
2016-10-30 12:41:33 +00:00
git tag -a $(VERSION) -m 'version $(VERSION)'
git push --tags