#!/usr/bin/make -f
# -*- makefile -*-

export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

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

override_dh_auto_clean:
	rm bson/_cbson.so  pymongo/_cmessage.so pymongo.egg-info -rf
	find . -name '*.so' -delete
	dh_auto_clean

override_dh_installchangelogs:
	dh_installchangelogs doc/changelog.rst

override_dh_compress:
	dh_compress -X.html

execute_after_dh_installdocs:
	PYTHONPATH=. http_proxy='http://127.0.0.1:9/' sphinx-build -N -q -E -bhtml doc/ debian/python-pymongo-doc/usr/share/doc/python-pymongo-doc/html/

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	# Run dh_sphinxdoc only on python-pymongo-doc, see #745690
	dh_sphinxdoc -ppython-pymongo-doc
endif
