#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

export PYBUILD_NAME=yamlfix
export PYBUILD_AFTER_INSTALL=rm -rf {destdir}/usr/lib/python3*/dist-packages/htmlcov \
                                    {destdir}/usr/lib/python3*/dist-packages/.coverage \
                                    {destdir}/usr/lib/python3*/dist-packages/coverage.xml
export PYBUILD_SYSTEM=pyproject
# python3-maison leaks the config-file handle it opens (a maison bug); under
# Python 3.14 pytest's unraisableexception plugin turns that into a test
# failure, and the project runs pytest with -W error. Disable the plugin.
export PYBUILD_TEST_ARGS=-p no:unraisableexception

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_install:
	PYTHONPATH="$(wildcard $(CURDIR)/debian/python3-yamlfix/usr/lib/python3*/dist-packages)" \
	help2man --no-info --section=1 \
		--name="A simple opinionated yaml formatter that keeps your comments!" \
		--version-string="$(DEB_VERSION_UPSTREAM)" \
		$(CURDIR)/debian/python3-yamlfix/usr/bin/yamlfix > debian/yamlfix.1

execute_after_dh_auto_clean:
	rm -f debian/yamlfix.1
