#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME=maxminddb

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

override_dh_auto_build:
	PYTHONPATH=.:$$PYTHONPATH sphinx-build -b html -d .build/.doctrees -N docs .build/html
	dh_auto_build

override_dh_auto_clean:
	dh_auto_clean
	rm -f maxminddb/extension.so maxminddb/extension.*.so
	rm -rf .build/ maxminddb.egg-info/

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