#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1

export PYBUILD_NAME=aiosmtpd
export PYBUILD_TEST_ARGS=-k "not (unknown_args_ or factory_none or noexc_smtpd_missing)"

# main packaging script based on dh7 syntax
%:
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild

override_dh_auto_install:
	dh_auto_install
	find debian/python3-aiosmtpd/usr/share/doc/python3-aiosmtpd -maxdepth 2 -type d -name "__pycache__" -exec rm -rf {} \;
	find debian/python3-aiosmtpd/ -name ".gitignore" -delete

override_dh_installdocs:
	PYTHONPATH=. python3 -m sphinx -N -q -E -b html aiosmtpd/docs debian/compiled_doc/html
	PYTHONPATH=. python3 -m sphinx -N -q -E -b man aiosmtpd/docs debian/compiled_doc/manpage
	dh_installdocs

override_dh_python3:
	dh_python3
	rm -rf debian/python3-aiosmtpd/usr/lib/python3/dist-packages/aiosmtpd/docs
