#!/usr/bin/make -f

export DH_ALWAYS_EXCLUDE=__pycache__

export DH_VERBOSE=1
export PYBUILD_VERBOSE=1

export LANG=C.UTF-8
export LC_ALL=C.UTF-8

export PYBUILD_NAME=guizero
export PYBUILD_BEFORE_TEST=cp -rv {dir}/tests {build_dir}; cp -v {dir}/examples/guizero* {build_dir}/tests
export PYBUILD_AFTER_TEST=rm -rfv {build_dir}/tests

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

override_dh_auto_clean:
	dh_auto_clean
	rm -rf html

override_dh_auto_build:
	dh_auto_build
	mv $(CURDIR)/docs-src/docs/about.md $(CURDIR)/docs-src/docs/index.md
	mkdocs build -d $(CURDIR)/html -f $(CURDIR)/docs-src/mkdocs.yml
	find $(CURDIR)/html -type f -name sitemap.xml.gz -delete

override_dh_auto_test:
	xvfb-run -a dh_auto_test

override_dh_compress:
	dh_compress -Xchangelog.html

override_dh_installchangelogs:
	dh_installchangelogs docs-src/docs/changelog.md upstream
	dh_installchangelogs

override_dh_installdocs:
	dh_installdocs
	dh_mkdocs -Tmkdocs -Tmkdocs-nature -Tlibjs-underscore -Tnode-jquery