#!/usr/bin/make -f
#export DH_VERBOSE=1
#export DEB_BUILD_OPTIONS=nocheck
export PYBUILD_NAME=pydocstyle

DEBDATE := $(shell dpkg-parsechangelog -Sdate | date -u +%F -f -)

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

override_dh_auto_test:
	PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="{interpreter} -Wd -m pytest -v -x src/tests/test_d*" dh_auto_test
	# skip test_integration (install_package needs fix, doesn't run with py3, writes into /usr/local etc.)
	# https://github.com/PyCQA/pydocstyle/issues/177

override_dh_installchangelogs:
	dh_installchangelogs docs/release_notes.rst

override_dh_installman:
	PYTHONPATH=./src sphinx-build -D today_fmt="$(DEBDATE)" -N -bman docs .pybuild
	dh_installman .pybuild/pydocstyle.1

override_dh_auto_install:
	dh_auto_install
	rm -f debian/pydocstyle/usr/bin/pep257 # temporary convenience script
