#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME=maxminddb

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

override_dh_auto_build:
	cp docs/html/_sources/index.rst.txt docs-source/index.rst
	PYTHONPATH=.:$$PYTHONPATH sphinx-build -b html -d .build/.doctrees -N docs-source .build/html
	dh_auto_build

override_dh_auto_clean:
	dh_auto_clean --buildsystem=pybuild
	rm -rf .build/
	rm -f docs-source/index.rst

override_dh_auto_test:
	dh_auto_test -- --before-test "ln -sf {dir}/README.rst {build_dir}/" \
			--after-test "rm -f {build_dir}/README.rst"
