#! /usr/bin/make -f

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

export PYBUILD_NAME=httpx
# tests marked "network" by upstream need internet access: test_connect_timeout,
# test_async_proxy_close and test_sync_proxy_close
export PYBUILD_TEST_ARGS=-m 'not network'

%:
	dh $@ --buildsystem=pybuild

# Run the installed script against the module just installed for the default
# interpreter (dh_python3 merges it into usr/lib/python3 only later), without
# leaving bytecode behind. COLUMNS keeps rich from wrapping the help text, and
# httpx has no --version option. The sed drops the "HTTPX <emoji>" banner that
# opens the --help output, which help2man turns into a paragraph of its own.
execute_after_dh_auto_install:
	PYTHONPATH=debian/python3-httpx/usr/lib/$(shell py3versions -d)/dist-packages \
	PYTHONDONTWRITEBYTECODE=1 COLUMNS=1000 \
		help2man --no-info --version-string=$(DEB_VERSION_UPSTREAM) \
		--name='next generation HTTP client' \
		--output=debian/httpx.1 debian/python3-httpx/usr/bin/httpx
	sed -i '/^\.IP$$/{N;/\nHTTPX /d}' debian/httpx.1
