#! /usr/bin/make -f

export PYBUILD_NAME=locust
%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_build-indep:
	dh_auto_build -i
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	PYTHONPATH=$(CURDIR) http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	sphinx-build -N -E -T -b html . $(CURDIR)/.pybuild/docs/html/
	rm -rf $(CURDIR)/.pybuild/docs/html/.doctrees
endif

override_dh_installdocs:
	dh_installdocs
	dh_installdocs -ppython-locust-doc $(CURDIR)/.pybuild/docs/html/

override_dh_auto_test:
	-PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} {interpreter} -m pytest -v" dh_auto_test

override_dh_installexamples:
	dh_installexamples -X.pyc
