#!/usr/bin/make -f
export DH_VERBOSE=1
export PYBUILD_NAME=blosc
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export BLOSC_DIR=/usr

%:
ifeq (,$(filter nodoc, $(DEB_BUILD_PROFILES)))
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild
else
	dh $@ --with python3 --buildsystem=pybuild
endif

override_dh_auto_install:
	dh_auto_install
ifeq (,$(filter nodoc, $(DEB_BUILD_OPTIONS)))
	python3 setup.py build_ext -i
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N doc/ debian/python-blosc-doc/usr/share/doc/python-blosc-doc/html/
endif

override_dh_installdocs:
ifeq (,$(filter nodoc, $(DEB_BUILD_OPTIONS)))
	rst2html -r 5 README.rst .pybuild/README.html
	LANG=C.UTF-8 links -dump .pybuild/README.html > .pybuild/README
endif
	dh_installdocs -A .pybuild/README

override_dh_installchangelogs:
	dh_installchangelogs RELEASE_NOTES.rst
