#!/usr/bin/make -f
export PYBUILD_NAME=python-deepl

# Tests require a Deepl API key (actually, tests are broken because the project
# is using pydantic v1 and Debian has v2. Fix submitted upstream, but still,
# API key is required for the tests so there's no sense adding the patch.)
export PYBUILD_DISABLE=test

PYVERS=$(shell python3 -c \
	'import sysconfig; print(sysconfig.get_python_version())')
PYPATH=debian/python3-deepl/usr/lib/python$(PYVERS)/dist-packages \

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_install:
	PYTHONPATH=$(PYPATH) help2man -N \
		--include debian/help2man.include --output debian/deepl.1 \
		--name="$(shell sed -n 's/^Description: //p' debian/control | head -1)" \
		--no-discard-stderr debian/python3-deepl/usr/bin/deepl
