#!/usr/bin/make -f
export DH_VERBOSE=1

DPKG_EXPORT_BUILDFLAGS=1
include /usr/share/dpkg/default.mk

export PYBUILD_NAME=pytest_tap
export PYTEST_PLUGINS=pytester
export HATCH_METADATA_CLASSIFIERS_NO_VERIFY=1

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	find .pybuild -type d -name 'cpython3_*_pytest_tap' | while read d; do \
		cp -v conftest.py $$d/build/; \
	done
	dh_auto_test
	find .pybuild -type f -name conftest.py -delete
endif

override_dh_installchangelogs:
	dh_installchangelogs docs/releases.rst
