#!/usr/bin/make -f

export PYBUILD_NAME=qmix

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

override_dh_auto_test:
# Exclude s390x from running tests
ifeq ($(DEB_HOST_ARCH), s390x)
	@echo "Tests disabled on s390x architecture."
else
	dh_auto_test
endif

override_dh_installdocs:
	https_proxy='127.0.0.1:9' http_proxy='127.0.0.1:9' sphinx-build -b html docs/source build/sphinx/html

	# Replace .js files in the package with local URLs
	find build/sphinx/html -type f -name '*.html' -exec sed -i 's|src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"|src="/usr/share/javascript/requirejs/require.min.js"|g' {} +

	dh_installdocs -ppython-qmix-doc --doc-main-package=python-qmix-doc build/sphinx/html
	dh_installdocs
