#!/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_AFTER_INSTALL=mv '{destdir}/{install_dir}/examples' \
	'{destdir}/usr/share/doc/python3-aiosmtpd/'

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

override_dh_auto_install:
	dh_auto_install
	rm -rf debian/python3-aiosmtpd/usr/share/doc/python3-aiosmtpd/examples/__pycache__

override_dh_installdocs:
	PYTHONPATH=. sphinx-build -N -q -E -c ./ -b html . debian/compiled_doc/temp
	mv debian/compiled_doc/temp/aiosmtpd/docs debian/compiled_doc/html
	dh_installdocs

override_dh_installman:
	mkdir -p debian/compiled_doc/manpage
	rst2man aiosmtpd/docs/manpage.rst > debian/compiled_doc/manpage/aiosmtpd.man
	dh_installman

override_dh_installchangelogs:
	dh_installchangelogs aiosmtpd/docs/NEWS.rst
