#!/usr/bin/make -f

export PYBUILD_NAME=respx
export PYTEST_ADDOPTS = --asyncio-mode=auto --cov-fail-under 95 -k 'not test_pass_through[httpcore-route0-True] and not test_pass_through[httpcore-route2-False] and not test_pass_through[httpcore-route3-True]'

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_install:
	# Exclude coverage from installing
	rm -f debian/python3-respx/usr/lib/python3*/dist-packages/coverage.xml
	rm -f debian/python3-respx/usr/lib/python3*/dist-packages/.coverage

override_dh_installdocs:
	PYTHONPATH=. https_proxy='127.0.0.1:9' http_proxy='127.0.0.1:9' mkdocs build -d build/html

	# Remove or replace privacy-breach URLs with local paths
	find -type f -name "*.html" -exec sed -i 's|https://fonts.gstatic.com|(URL removed)|g' {} +
	find -type f -name "*.html" -exec sed -i 's|https://fonts.googleapis.com/css|(URL removed)|g' {} +

	dh_installdocs -ppython-respx-doc --doc-main-package=python-respx-doc build/html
	dh_installdocs

override_dh_clean:
	dh_clean
	rm -f coverage.xml
	rm -f .coverage