#!/usr/bin/make -f

#export DH_VERBOSE=1
export PYBUILD_NAME=wand
# Testsuite is disabled, libmagickwand-dev 6.8 and higher
# as build-dependency breaks reprotest in salsa.
export PYBUILD_DISABLE=test

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

override_dh_auto_build:
	dh_auto_build
	$(MAKE) -C $(CURDIR)/docs html
	find $(CURDIR)/docs/_build/html -mindepth 2 -maxdepth 2 -type f | xargs sed -i 's;https://cdnjs.*HTMLorMML;../_static/mathjax.js;g'
	find $(CURDIR)/docs/_build/html -maxdepth 1 -type f | xargs sed -i 's;https://cdnjs.*HTMLorMML;_static/mathjax.js;g'

override_dh_install:
	dh_install
	rm -f $(CURDIR)/debian/*/usr/README.rst
	rm -f $(CURDIR)/debian/*/usr/lib/*/README.rst

override_dh_installchangelogs:
	dh_installchangelogs $(CURDIR)/docs/changes.rst

override_dh_auto_clean:
	dh_auto_clean
	$(MAKE) -C $(CURDIR)/docs clean
