#!/usr/bin/make -f

export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export PYBUILD_NAME=djvu
export PYBUILD_TEST_CUSTOM=1
export PYBUILD_TEST_ARGS=\
	cd {build_dir}/tests; \
	env -u LANGUAGE {interpreter} -m pytest -v

%:
ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	dh $@ --buildsystem=pybuild

else
	dh $@ --with sphinxdoc --buildsystem=pybuild
endif

override_dh_installdocs:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	python3 setup.py build_ext -i
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -b html doc/api build/sphinx/html
endif
	dh_installdocs -Xobjects.inv

override_dh_strip:
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip -ppython3-djvu
endif
