pycodestyle.mk (824B)
1 ifndef PY_SRC 2 $(error Define PY_SRC variable with list of python source files before including pycodestyle.mk) 3 endif 4 5 pycodestyle_venv_name?=dev 6 pycodestyle_venv:=$(VENV_BASE)/$(pycodestyle_venv_name)-$(PYTHON_IMPL) 7 8 ### expected packages, add them into dev-requirements.in: 9 # black 10 # isort 11 # pylama 12 ### to use fixed mypy integration with pylama use instead: 13 # pylama[toml,mypy] @ https://codeload.github.com/ccxcz/pylama/zip/14200a96c46acde592ee3effc24bc82a4217026d 14 15 pycodestyle: $(patsubst %.py,.pycodestyle/%.pyfmt,$(PY_SRC)) 16 '$(pycodestyle_venv)/bin/pylama' *.py rcm_db || true 17 18 .pycodestyle/%.pyfmt: %.py $(pycodestyle_venv)/.done 19 mkdir -p '$(dir $@)' 20 '$(pycodestyle_venv)/bin/isort' --profile=black - <$< >$<.tmp1 21 '$(pycodestyle_venv)/bin/black' -S - <$<.tmp1 >$<.tmp2 22 rm '$<.tmp1' 23 mv '$<.tmp2' '$<' 24 touch '$@'