#!/usr/bin/make -f
export PYBUILD_NAME=pkginfo
# Let's ship pkginfo executable only in the python3 version of the package
export PYBUILD_AFTER_INSTALL_python2=rm -f {destdir}/usr/bin/pkginfo && find {destdir} -type d -empty -delete && rm -rf '{destdir}/{install_dir}/pkginfo/tests'
export PYBUILD_AFTER_INSTALL_python3=rm -rf '{destdir}/{install_dir}/pkginfo/tests'

%:
	dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build --buildsystem=pybuild
	python3 setup.py build_sphinx

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e -x; \
	cd $(CURDIR)/pkginfo/tests/sneaky ; python setup.py egg_info ; cd ../../..
	dh_auto_test
endif
