#!/usr/bin/make -f

# Build the rpi_hwid Python package with dh-python/pybuild straight from
# pyproject.toml (hatchling backend). The upstream version is normally derived
# from git by hatch-vcs, but during the .deb build there may be no VCS context
# in the unpacked source, so we pin it to the changelog version through
# SETUPTOOLS_SCM_PRETEND_VERSION. The changelog is written by each build
# (mithro/apt-repo-action's scripts/deb-version.py): X.Y[.postN], then ~deb<R>
# for the suite and ~pr<P> for a pull request preview. Those suffixes aren't
# PEP 440, so the Python version is the part before the first "~": the same
# X.Y[.postN] the wheel on PyPI carries. dpkg source format is native, so there
# is no Debian revision to strip.
export PYBUILD_NAME = rpi_hwid
export SETUPTOOLS_SCM_PRETEND_VERSION = $(firstword $(subst ~, ,$(shell dpkg-parsechangelog -SVersion)))

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

# The test suite renders a PDF and decodes its QR codes with zxing, which is
# not in Debian; it runs in the CI test job, not during packaging.
override_dh_auto_test:
	:
