2016-11-01 08:49:44 +00:00
|
|
|
VERSION := $(shell python setup.py --version)
|
|
|
|
|
2016-11-02 20:58:30 +00:00
|
|
|
CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')
|
2016-11-01 08:49:44 +00:00
|
|
|
|
2018-11-08 21:12:50 +00:00
|
|
|
CYTHON_DIRECTIVES = -Xlanguage_level=2
|
2016-11-01 08:49:44 +00:00
|
|
|
|
2016-11-02 15:21:40 +00:00
|
|
|
ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
|
2016-11-02 17:28:11 +00:00
|
|
|
CYTHON_DIRECTIVES += -Xprofile=True
|
|
|
|
CYTHON_DIRECTIVES += -Xlinetrace=True
|
2016-11-01 08:49:44 +00:00
|
|
|
endif
|
|
|
|
|
2016-10-30 12:41:33 +00:00
|
|
|
|
2016-10-30 21:59:42 +00:00
|
|
|
clean:
|
|
|
|
# Clean sources
|
2016-11-02 20:58:30 +00:00
|
|
|
find src -name '*.py[cod]' -delete
|
|
|
|
find src -name '__pycache__' -delete
|
|
|
|
find src -name '*.c' -delete
|
2016-11-11 15:35:58 +00:00
|
|
|
find src -name '*.h' -delete
|
2016-11-02 20:58:30 +00:00
|
|
|
find src -name '*.so' -delete
|
|
|
|
find src -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/
|
2016-11-02 20:58:30 +00:00
|
|
|
find src -name '*.html' -exec mv {} reports/cython/ \;
|
2016-10-31 09:30:57 +00:00
|
|
|
|
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
|
|
|
|
2020-06-17 01:39:11 +00:00
|
|
|
docs-live:
|
2020-06-14 21:35:25 +00:00
|
|
|
sphinx-autobuild docs docs/_build/html
|
|
|
|
|
2016-11-02 21:55:14 +00:00
|
|
|
install: uninstall clean cythonize
|
2016-11-02 22:56:30 +00:00
|
|
|
pip install -ve .
|
2016-11-02 20:58:30 +00:00
|
|
|
|
2016-11-02 21:17:50 +00:00
|
|
|
uninstall:
|
|
|
|
- pip uninstall -y -q dependency-injector 2> /dev/null
|
|
|
|
|
2018-10-18 16:39:19 +00:00
|
|
|
test-py2: build
|
2016-10-30 21:59:42 +00:00
|
|
|
# Unit tests with coverage report
|
|
|
|
coverage erase
|
2018-10-18 16:39:19 +00:00
|
|
|
coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*_py2_py3.py
|
|
|
|
coverage report --rcfile=./.coveragerc
|
|
|
|
coverage html --rcfile=./.coveragerc
|
|
|
|
|
|
|
|
test-py3: build
|
|
|
|
# Unit tests with coverage report
|
|
|
|
coverage erase
|
|
|
|
coverage run --rcfile=./.coveragerc -m unittest2 discover -s tests/unit/ -p test_*py3.py
|
2016-10-30 21:59:42 +00:00
|
|
|
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
|
2016-11-02 21:55:14 +00:00
|
|
|
flake8 --max-complexity=10 src/dependency_injector/
|
2016-10-30 21:59:42 +00:00
|
|
|
flake8 --max-complexity=10 examples/
|
|
|
|
# Code style analysis
|
2016-11-02 21:55:14 +00:00
|
|
|
pydocstyle src/dependency_injector/
|
2016-10-30 21:59:42 +00:00
|
|
|
pydocstyle examples/
|
|
|
|
|
2016-11-01 08:49:44 +00:00
|
|
|
publish: cythonize
|
2017-06-08 22:45:12 +00:00
|
|
|
# Merge release to master branch
|
|
|
|
git checkout master
|
2017-06-08 22:53:14 +00:00
|
|
|
git merge --no-ff release/$(VERSION) -m "Merge branch 'release/$(VERSION)' into master"
|
2017-06-08 22:45:12 +00:00
|
|
|
git push origin master
|
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
|
2017-06-08 22:45:12 +00:00
|
|
|
# Create and upload build
|
|
|
|
python setup.py sdist upload
|