#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export SETUPTOOLS_SCM_PRETEND_VERSION=${DEB_VERSION_UPSTREAM}

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

override_dh_auto_test:
	# see https://github.com/agronholm/anyio/issues/368#issuecomment-915535102 for the reason to run egg_info
	# -W ignore is needed with py3.9.7 as it produces errors with some DeprecationWarnings
	mkdir -p .pybuild/egg
	PYTHONPATH=$(CURDIR)/.pybuild/egg \
	  dh_auto_test -- \
	  --before-test '{interpreter} {dir}/setup.py egg_info --egg-base={dir}/.pybuild/egg' \
	  --test-pytest \
	  --test-args '--verbose -W ignore -k "not test_is_block_device and not test_getaddrinfo"'
