#!/usr/bin/make -f

export PYBUILD_NAME=guidata
export GUIDATA_UNATTENDED_TESTS=1

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_clean:
	rm -rf build/html

execute_after_dh_auto_build:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	env PYTHONPATH=$(shell pybuild --build -i python3 -s custom --build-args 'echo {build_dir}') \
	SPHINXBUILD="python3 -m sphinx" \
	SPHINXOPTS="-D mathjax_path=MathJax.js -D qt_documentation=PyQt5" \
	sphinx-build -N -bhtml doc build/html
endif

execute_after_dh_auto_test:
	# remove generated test file not removed by the upstream.
	pybuild --build -s custom --build-args 'rm -f {build_dir}/test.json'

execute_after_dh_auto_install:
	# install the .desktop files
	dh_install -p python3-guidata guidata-tests.desktop /usr/share/applications
