15
15
#
16
16
17
17
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
20
19
# make pylint to check Python code for enhanced compliance including naming
21
20
# and documentation
22
21
# make coverage-report to check coverage of the python scripts by the tests
@@ -26,11 +25,11 @@ MODULE=cwltool
26
25
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
27
26
# `[[` conditional expressions.
28
27
PYSOURCES =$(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 \
30
29
pytest-xdist==1.27.0 isort wheel -rtest-requirements.txt
31
30
DEBDEVPKGS =pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
32
31
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 \
34
33
--format=format:% cd --date=format-local:% Y% m% d% H% M% S)
35
34
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
36
35
UNAME_S =$(shell uname -s)
@@ -44,8 +43,11 @@ help: Makefile
44
43
@sed -n ' s/^##//p' $<
45
44
46
45
# # install-dep : install most of the development dependencies via pip
47
- install-dep :
46
+ install-dep : install-dependencies
47
+
48
+ install-dependencies :
48
49
pip install --upgrade $(DEVPKGS )
50
+ pip install -r requirements.txt
49
51
50
52
# # install-deb-dep: install most of the dev dependencies via apt-get
51
53
install-deb-dep :
@@ -78,19 +80,6 @@ clean: FORCE
78
80
sort_imports :
79
81
isort ${MODULE} /* .py tests/* .py setup.py
80
82
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
-
94
83
pep257 : pydocstyle
95
84
# # pydocstyle : check Python code style
96
85
pydocstyle : $(PYSOURCES )
@@ -102,14 +91,9 @@ pydocstyle_report.txt: $(PYSOURCES)
102
91
diff_pydocstyle_report : pydocstyle_report.txt
103
92
diff-quality --violations=pycodestyle --fail-under=100 $^
104
93
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
113
97
114
98
# # pylint : run static code analysis on Python code
115
99
pylint : $(PYSOURCES )
@@ -143,8 +127,8 @@ coverage-report: .coverage
143
127
diff-cover : coverage.xml
144
128
diff-cover $^
145
129
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 $@
148
132
149
133
# # test : run the ${MODULE} test suite
150
134
test : $(pysources )
@@ -165,18 +149,14 @@ list-author-emails:
165
149
@echo ' name, E-Mail Address'
166
150
@git log --format=' %aN,%aE' | sort -u | grep -v ' root'
167
151
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
180
160
MYPYPATH=$$ MYPYPATH:typeshed/3:typeshed/2and3 mypy --disallow-untyped-calls \
181
161
--warn-redundant-casts \
182
162
cwltool
0 commit comments