2121# make coverage-report to check coverage of the python scripts by the tests
2222
2323MODULE =cwl_utils
24+ PACKAGE =cwl-utils
25+ EXTRAS =
2426
2527# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2628# `[[` conditional expressions.
2729PYSOURCES =$(filter-out parser/cwl_v% ,$(shell find $(MODULE ) -name "* .py") ) $(wildcard tests/* .py) *.py
28- DEVPKGS =diff_cover black pylint coverage pep257 pydocstyle flake8 mypy\
29- isort wheel autoflake
30+ DEVPKGS =diff_cover black pylint pep257 pydocstyle flake8 tox tox-pyenv \
31+ isort wheel autoflake flake8-bugbear pyupgrade bandit \
32+ -rtest-requirements.txt -rmypy-requirements.txt
3033DEBDEVPKGS =pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
3134 python-flake8 python-mock shellcheck
3235VERSION =$(shell awk '{print $3}' < cwl_utils/__meta__.py )
3336mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
3437UNAME_S =$(shell uname -s)
3538
3639# # all : default task
37- all :
38- pip install -e .
40+ all : dev
3941
4042# # help : print this help message and exit
4143help : Makefile
@@ -46,20 +48,19 @@ install-dep: install-dependencies
4648
4749install-dependencies :
4850 pip install --upgrade $(DEVPKGS )
49- pip install -r requirements.txt -r mypy_requirements .txt -r docs/requirements.txt
51+ pip install -r requirements.txt -r mypy-requirements .txt -r docs/requirements.txt
5052
5153# # install-deb-dep: install most of the dev dependencies via apt-get
5254install-deb-dep :
5355 sudo apt-get install $(DEBDEVPKGS )
5456
55- # # install : install the ${MODULE} module and schema-salad-tool
57+ # # install : install the ${MODULE} module and scripts
5658install : FORCE
57- pip install .[deps]
59+ pip install .$( EXTRAS )
5860
5961# # dev : install the ${MODULE} module in dev mode
6062dev : install-dep
61- pip install -e .[deps]
62-
63+ pip install -e .$(EXTRAS )
6364
6465# # dist : create a module package for distribution
6566dist : dist/${MODULE}-$(VERSION ) .tar.gz
@@ -101,12 +102,15 @@ diff_pydocstyle_report: pydocstyle_report.txt
101102format : $(PYSOURCES )
102103 black $^
103104
105+ format-check : $(PYSOURCES )
106+ black --diff --check $^
107+
104108# # pylint : run static code analysis on Python code
105109pylint : $(PYSOURCES )
106110 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
107111 $^ -j0|| true
108112
109- pylint_report.txt : ${ PYSOURCES}
113+ pylint_report.txt : $( PYSOURCES )
110114 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
111115 $^ -j0> $@ || true
112116
@@ -138,17 +142,17 @@ diff-cover.html: coverage.xml
138142
139143# # test : run the ${MODULE} test suite
140144test : $(PYSOURCES )
141- pytest # --addopts "-n auto --dist=loadfile"
145+ python setup.py test ${PYTEST_EXTRA}
142146
143147# # testcov : run the ${MODULE} test suite and collect coverage
144148testcov : $(PYSOURCES )
145- pytest --cov ${MODULE} # -n auto --dist=loadfile"
149+ python setup.py test --addopts " --cov " ${PYTEST_EXTRA}
146150
147- sloccount.sc : ${ PYSOURCES} Makefile
151+ sloccount.sc : $( PYSOURCES ) Makefile
148152 sloccount --duplicates --wide --details $^ > $@
149153
150154# # sloccount : count lines of code
151- sloccount : ${ PYSOURCES} Makefile
155+ sloccount : $( PYSOURCES ) Makefile
152156 sloccount $^
153157
154158list-author-emails :
@@ -165,17 +169,24 @@ mypy: $(filter-out setup.py,${PYSOURCES})
165169 fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
166170 MYPYPATH=$$ MYPYPATH:typeshed mypy $^
167171
172+ pyupgrade : $(PYSOURCES )
173+ pyupgrade --exit-zero-even-if-changed --py36-plus $^
174+
168175release-test : FORCE
169176 git diff-index --quiet HEAD -- || ( echo You have uncommited changes, please commit them and try again; false )
170177 ./release-test.sh
171178
172179release : release-test
173180 . testenv2/bin/activate && \
174- python testenv2/src/${MODULE} /setup.py sdist bdist_wheel && \
181+ python testenv2/src/${PACKAGE} /setup.py sdist bdist_wheel
182+ . testenv2/bin/activate && \
175183 pip install twine && \
176- twine upload testenv2/src/${MODULE } /dist/* && \
184+ twine upload testenv2/src/${PACKAGE } /dist/* && \
177185 git tag ${VERSION} && git push --tags
178186
187+ flake8 : $(PYSOURCES )
188+ flake8 $^
189+
179190FORCE :
180191
181192# Use this to print the value of a Makefile variable
0 commit comments