#!/usr/bin/make -f

PYTHON2_VERSIONS=$(shell pyversions -vr)
PYTHON3_VERSIONS=$(shell py3versions -vr)
PYTHON_VERSIONS=${PYTHON2_VERSIONS} ${PYTHON3_VERSIONS}

export PYBUILD_NAME=django-debug-toolbar
export PYBUILD_TEST_PYTEST=1

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

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
test-python%:
	PYTHONPATH=. DJANGO_SETTINGS_MODULE=tests.settings python$* /usr/bin/django-admin test tests

override_dh_auto_test: $(foreach pyversion,${PYTHON_VERSIONS},$(pyversion:%=test-python%))
endif

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/ build/html
