1515#
1616# Contact: common-workflow-language@googlegroups.com
1717
18- # make pycodestyle to check for basic Python code compliance
19- # make autopep8 to fix most pep8 errors
18+ # make format to fix most python formatting errors
2019# make pylint to check Python code for enhanced compliance including naming
2120# and documentation
2221# make coverage-report to check coverage of the python scripts by the tests
@@ -26,11 +25,11 @@ MODULE=cwltool
2625# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2726# `[[` conditional expressions.
2827PYSOURCES =$(wildcard ${MODULE}/** .py tests/* .py) setup.py
29- DEVPKGS =pycodestyle diff_cover autopep8 pylint coverage pydocstyle flake8 \
28+ DEVPKGS =diff_cover black pylint coverage pep257 pydocstyle flake8 mypy \
3029 pytest-xdist==1.27.0 isort wheel -rtest-requirements.txt
3130DEBDEVPKGS =pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
3231 python-flake8 python-mock shellcheck
33- VERSION =1 .0.$(shell TZ=UTC git log --first-parent --max-count=1 \
32+ VERSION =2 .0.$(shell TZ=UTC git log --first-parent --max-count=1 \
3433 --format=format:% cd --date=format-local:% Y% m% d% H% M% S)
3534mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
3635UNAME_S =$(shell uname -s)
@@ -44,8 +43,11 @@ help: Makefile
4443 @sed -n ' s/^##//p' $<
4544
4645# # install-dep : install most of the development dependencies via pip
47- install-dep :
46+ install-dep : install-dependencies
47+
48+ install-dependencies :
4849 pip install --upgrade $(DEVPKGS )
50+ pip install -r requirements.txt
4951
5052# # install-deb-dep: install most of the dev dependencies via apt-get
5153install-deb-dep :
@@ -78,19 +80,6 @@ clean: FORCE
7880sort_imports :
7981 isort ${MODULE} /* .py tests/* .py setup.py
8082
81- pep8 : pycodestyle
82- # # pycodestyle : check Python code style
83- pycodestyle : $(PYSOURCES )
84- pycodestyle --exclude=_version.py --show-source --show-pep8 $^ || true
85-
86- pep8_report.txt : pycodestyle_report.txt
87- pycodestyle_report.txt : $(PYSOURCES )
88- pycodestyle --exclude=_version.py $^ > $@ || true
89-
90- diff_pep8_report : diff_pycodestyle_report
91- diff_pycodestyle_report : pycodestyle_report.txt
92- diff-quality --violations=pycodestyle $^
93-
9483pep257 : pydocstyle
9584# # pydocstyle : check Python code style
9685pydocstyle : $(PYSOURCES )
@@ -102,14 +91,9 @@ pydocstyle_report.txt: $(PYSOURCES)
10291diff_pydocstyle_report : pydocstyle_report.txt
10392 diff-quality --violations=pycodestyle --fail-under=100 $^
10493
105- # # autopep8 : fix most Python code indentation and formatting
106- autopep8 : $(PYSOURCES )
107- autopep8 --recursive --in-place --ignore E309 $^
108-
109- # A command to automatically run astyle and autopep8 on appropriate files
110- # # format : check/fix all code indentation and formatting (runs autopep8)
111- format : autopep8
112- # Do nothing
94+ # # format : check/fix all code indentation and formatting (runs black)
95+ format :
96+ black --exclude cwltool/schemas setup.py cwltool.py cwltool tests
11397
11498# # pylint : run static code analysis on Python code
11599pylint : $(PYSOURCES )
@@ -143,8 +127,8 @@ coverage-report: .coverage
143127diff-cover : coverage.xml
144128 diff-cover $^
145129
146- diff-cover.html : coverage.xml
147- diff-cover $^ --html-report diff-cover.html
130+ diff-cover.html : coverage.xml
131+ diff-cover $^ --html-report $@
148132
149133# # test : run the ${MODULE} test suite
150134test : $(pysources )
@@ -165,18 +149,14 @@ list-author-emails:
165149 @echo ' name, E-Mail Address'
166150 @git log --format=' %aN,%aE' | sort -u | grep -v ' root'
167151
168- mypy2 : ${PYSOURCES}
169- rm -Rf typeshed/2and3/ruamel/yaml
170- ln -s $(shell python -c 'from __future__ import print_function; import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__) )' ) \
171- typeshed/2and3/ruamel/yaml
172- MYPYPATH=$$ MYPYPATH:typeshed/2.7:typeshed/2and3 mypy --py2 --disallow-untyped-calls \
173- --warn-redundant-casts \
174- cwltool
175-
176- mypy3 : ${PYSOURCES}
177- rm -Rf typeshed/2and3/ruamel/yaml
178- ln -s $(shell python3 -c 'from __future__ import print_function; import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__) )' ) \
179- typeshed/2and3/ruamel/yaml
152+ mypy3 : mypy
153+ mypy : ${PYSOURCES}
154+ if ! test -f $( shell python3 -c ' import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))' ) /py.typed ; \
155+ then \
156+ rm -Rf typeshed/2and3/ruamel/yaml ; \
157+ ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__) )' ) \
158+ typeshed/2and3/ruamel/ ; \
159+ fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
180160 MYPYPATH=$$ MYPYPATH:typeshed/3:typeshed/2and3 mypy --disallow-untyped-calls \
181161 --warn-redundant-casts \
182162 cwltool
0 commit comments