#!/usr/bin/make -f

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

export PYBUILD_NAME=pylatexenc
export PYBUILD_TEST_PYTEST=1

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

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	sphinx-build -b html -N doc/ $(CURDIR)/debian/python-pylatexenc-doc/usr/share/doc/python-pylatexenc-doc/html
	dh_sphinxdoc
endif

# Target for regenerating the manpages.
# This target is intended to be executed manually, and requires
# `help2man` to be installed.
help2man:
	for script in latex2text latexencode latexwalker; do \
	help2man --no-info \
		--name="part of pylatexenc: simple LaTeX parser provider conversion to/from unicode" \
		--version-string=$(DEB_VERSION_UPSTREAM) \
		-o debian/$${script}.1 \
		--no-discard-stderr \
        --include debian/python3-pylatexenc.manpages.include \
        $${script}; \
	done
