python-dependency-injector/Makefile

65 lines
1.6 KiB
Makefile
Raw Normal View History

2016-11-01 11:49:44 +03:00
VERSION := $(shell python setup.py --version)
2016-11-02 23:58:30 +03:00
CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')
2016-11-01 11:49:44 +03:00
CYTHON_DIRECTIVES =
2016-11-02 18:21:40 +03:00
ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
2016-11-02 20:28:11 +03:00
CYTHON_DIRECTIVES += -Xprofile=True
CYTHON_DIRECTIVES += -Xlinetrace=True
2016-11-01 11:49:44 +03:00
endif
2016-10-30 15:41:33 +03:00
2016-10-31 00:59:42 +03:00
clean:
# Clean sources
2016-11-02 23:58:30 +03:00
find src -name '*.py[cod]' -delete
find src -name '__pycache__' -delete
find src -name '*.c' -delete
find src -name '*.so' -delete
find src -name '*.html' -delete
2016-10-31 00:59:42 +03: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 11:49:44 +03:00
cythonize:
2016-10-31 12:30:57 +03:00
# Compile Cython to C
2016-11-01 11:49:44 +03:00
cython -a $(CYTHON_DIRECTIVES) $(CYTHON_SRC)
2016-10-31 12:30:57 +03:00
# Move all Cython html reports
mkdir -p reports/cython/
2016-11-02 23:58:30 +03:00
find src -name '*.html' -exec mv {} reports/cython/ \;
2016-10-31 12:30:57 +03:00
2016-11-01 11:49:44 +03:00
build: clean cythonize
2016-10-31 12:30:57 +03:00
# Compile C extensions
2016-11-02 18:21:40 +03:00
python setup.py build_ext --inplace
2016-10-31 12:30:57 +03:00
2016-11-03 00:55:14 +03:00
install: uninstall clean cythonize
pip install . -v
2016-11-02 23:58:30 +03:00
2016-11-03 00:17:50 +03:00
uninstall:
- pip uninstall -y -q dependency-injector 2> /dev/null
2016-11-03 00:55:14 +03:00
test: build
2016-10-31 00:59:42 +03:00
# Unit tests with coverage report
coverage erase
2016-11-02 23:58:30 +03:00
coverage run --rcfile=./.coveragerc -m unittest2 discover tests/unit
2016-10-31 00:59:42 +03:00
coverage report --rcfile=./.coveragerc
coverage html --rcfile=./.coveragerc
2016-11-01 11:49:44 +03:00
check:
2016-10-31 00:59:42 +03:00
# Static analysis
2016-11-03 00:55:14 +03:00
flake8 --max-complexity=10 src/dependency_injector/
2016-10-31 00:59:42 +03:00
flake8 --max-complexity=10 examples/
# Code style analysis
2016-11-03 00:55:14 +03:00
pydocstyle src/dependency_injector/
2016-10-31 00:59:42 +03:00
pydocstyle examples/
2016-11-01 11:49:44 +03:00
publish: cythonize
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