#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# detect if build targets experimental suite (or is a draft)
DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

DH_OPTIONS = -O--buildsystem=pybuild

STEM = matrix-nio
DOCDIR = debian/python3-$(STEM)-doc/usr/share/doc/python3-$(STEM)-doc/html

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test $(if $(DEB_SUITE_EXP),|| true)
endif

# skip sphinx extension sphinx.ext.githubpages to omit creating .nojekyll
override_dh_sphinxdoc:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	sphinx-build \
		-D extensions=sphinx.ext.autodoc,sphinx.ext.doctest,sphinx.ext.coverage,sphinx.ext.viewcode,sphinx.ext.napoleon,m2r \
		-b html doc $(DOCDIR)
	dh_sphinxdoc -X.nojekyll
endif

%:
	dh $@ --with python3,sphinxdoc $(DH_OPTIONS:-O%=%)
