#!/usr/bin/make -f

#export DH_VERBOSE = 1

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

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

# Disable test_encrypted_key because it requires user input of a password
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1018159
export PYBUILD_TEST_ARGS=-k 'not test_encrypted_key' test

# Building package outside scm repo fails, so set the version explicitly:
export SETUPTOOLS_SCM_PRETEND_VERSION=$(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
	rm $(CURDIR)/debian/python-tpm2-pytss-doc/usr/share/doc/python-tpm2-pytss-doc/html/.nojekyll
	dh_sphinxdoc
endif
