#!/usr/bin/make -f

export PYBUILD_NAME=docformatter
export PYBUILD_TEST_ARGS=-v
export PYBUILD_BEFORE_TEST=cp -r {dir}/test_docformatter.py {build_dir}
export PYBUILD_AFTER_TEST=rm -f {build_dir}/test_docformatter.py

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_clean:
	dh_auto_clean
	rm -rf .pytest_cache
	rm -f $(PYBUILD_NAME).1

override_dh_auto_install:
	dh_auto_install
	PYTHONPATH=$(CURDIR) help2man debian/python3-$(PYBUILD_NAME)/usr/bin/$(PYBUILD_NAME) \
	  --no-info \
	  --name "$(shell grep '^Description' debian/control | head -n 1 | cut -d: -f2)" \
	  > $(PYBUILD_NAME).1

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_PROFILES)),)
	dh_auto_test
endif
