#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

export PYBUILD_NAME=meshplex
latestjs=https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

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


override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. sphinx-build -M html docs/ .pybuild/docs

override_dh_auto_test:
	for testdir in .pybuild/*/build/test; do ln -s $(CURDIR)/test/meshes $$testdir/meshes; done
	MPLBACKEND=Agg  dh_auto_test -- --test-args="--ignore-glob=*test_io*"

override_dh_sphinxdoc-indep:
	dh_sphinxdoc -i
	grep "$(latestjs)" debian/python-meshplex-doc/usr/share/doc/python-meshplex-doc/* -r --files-with-matches | xargs sed "s|src=\"$(latestjs)|src=\"file://usr/share/javascript/mathjax/unpacked/latest.js|g" -i
