#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
export PYBUILD_NAME=offlineimap3

# Tests require a valid IMAP account in order to run (see test/README).
# Disable them for now.
export PYBUILD_DISABLE=test

# Python applications should have their module private
# These modules should be installed in /usr/share/<module-name>
export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/offlineimap3/
export PYBUILD_DESTDIR=debian/offlineimap3

# Scripts should be installed to the same (private) directory.
# We cannot use --install-scripts in PYBUILD_INSTALL_ARGS since
# module name and script name are the same.
export PYBUILD_AFTER_INSTALL=\
	mv {destdir}/usr/bin/offlineimap {destdir}/usr/share/offlineimap3/run

%:
	dh $@ --with python3 --buildsystem=pybuild

execute_after_dh_auto_build:
	make -C docs man

override_dh_gencontrol:
	dh_gencontrol -p offlineimap -- -v7.3.3+dfsg1-1+$(DEB_VERSION)
	dh_gencontrol --remaining-packages