#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1

export PYBUILD_NAME = qtawesome

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
%:
	dh $@ --with sphinxdoc --buildsystem=pybuild

execute_after_dh_auto_build:
	PYTHONPATH=. python3 -m sphinx -N -b html docs/source build/html

override_dh_installdocs:
	dh_installdocs -ppython-qtawesome-doc --doc-main-package=python3-qtawesome
	dh_installdocs --remaining-packages

override_dh_installexamples:
	dh_installexamples -ppython-qtawesome-doc --doc-main-package=python3-qtawesome
	dh_installexamples --remaining-packages
else
%:
	dh $@ --buildsystem=pybuild
endif

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="cd {build_dir}; {interpreter} {dir}/example.py" \
		xvfb-run -a -s "-screen 0 1024x768x24 +extension GLX" dh_auto_test
	dh_auto_test -- --test-pytest --test-args qtawesome/tests
endif
