#!/usr/bin/make -f

XVFB_OPTS = --auto-servernum --server-num=20 -s "-screen 0 1024x768x24 -ac +extension GLX -noreset"

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME = moderngl
export PYBUILD_TEST_CUSTOM = 1
export PYBUILD_TEST_ARGS= xvfb-run $(XVFB_OPTS) {interpreter} -m pytest -k "not (test_local or test_documentation or test_module_integrity)"

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_test:
	-dh_auto_test --buildsystem=pybuild

execute_after_dh_auto_build:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(shell pybuild --print {build_dir} --interpreter python3) \
		sphinx-build -M html $(CURDIR)/docs $(CURDIR)/docs/_build
endif

