#!/usr/bin/make -f

#export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

export PYBUILD_NAME=tpm2_pytss
export PYBUILD_OPTION="--test-pytest"

# Building package outside scm repo fails, so set the version explicitly:
export SETUPTOOLS_SCM_PRETEND_VERSION=$(subst ~,-,$(DEB_VERSION_UPSTREAM))

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

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=./src python3 -m sphinx -b html -N docs/ \
		$(CURDIR)/debian/python-tpm2-pytss-doc/usr/share/doc/python-tpm2-pytss-doc/html
	dh_sphinxdoc
endif
