#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export PYBUILD_NAME=zeroconf

# special build flags for Debian package
export SKIP_CYTHON=True

DISABLE_TESTS = \
	    not test_integration_with_listener_ipv6 \
	and not test_launch_and_close \
	and not test_launch_and_close_context_manager \
	and not test_close_multiple_times \
	and not test_launch_and_close_v4_v6 \
	and not test_launch_and_close_v6_only \
	and not test_service_browser_expire_callbacks

ifeq      ($(DEB_HOST_ARCH),ppc64el)
  DISABLE_TESTS += and not test_run_coro_with_timeout
else ifeq ($(DEB_HOST_ARCH),s390x)
  DISABLE_TESTS += and not test_run_coro_with_timeout
endif

export PYBUILD_TEST_ARGS = -k "$(DISABLE_TESTS)"

%:
	dh $@ --buildsystem=pybuild

# remove coverage test file from installation tree
execute_after_dh_auto_install:
	rm -fv  debian/python3-zeroconf/usr/lib/python3*/dist-packages/.coverage
	rm -rfv debian/python3-zeroconf/usr/lib/python3*/dist-packages/.benchmarks/

# keep ".md" extension for changelogs
override_dh_installchangelogs:
	dh_installchangelogs --keep

# fix too old timestamps that breaks Debian package
execute_after_dh_installchangelogs:
	touch --no-create --date="@$(SOURCE_DATE_EPOCH)" debian/python3-zeroconf/usr/share/doc/python3-zeroconf/changelog
execute_after_dh_installdocs:
	touch --no-create --date="@$(SOURCE_DATE_EPOCH)" debian/python3-zeroconf/usr/share/doc/python3-zeroconf/README.rst
