#!/usr/bin/make -f

export PYBUILD_NAME=pglast

execute_before_dh_auto_build:
	# force a cython run
	cython3 pglast/parser.pyx

override_dh_auto_test-indep:

execute_after_dh_auto_test-arch:
	# clean up after coverage test
	rm -fv .pybuild/*/build/.coverage

execute_after_dh_auto_install-arch:
	# build manpage
	PYTHONPATH=$(CURDIR)/debian/python3-pglast/usr/lib/$(shell py3versions -d)/dist-packages \
		   help2man --name 'PostgreSQL language prettifier' --no-info \
		   debian/python3-pglast/usr/bin/pgpp > pgpp.1

execute_after_dh_auto_install-indep:
	# build docs
	$(MAKE) -C docs html SPHINXBUILD=sphinx-build PYTHONPATH=$(CURDIR)/debian/python3-pglast/usr/lib/$(shell py3versions -d)/dist-packages

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