#!/usr/bin/make -f
export PYBUILD_NAME=tetragon-client
export PYBUILD_SYSTEM=pyproject
export PYBUILD_TEST_PYTEST=1

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

# The distro's protobuf and grpcio are older than the PyPI wheel's floors:
# regenerate the stubs with the distro's own protoc and drop the floors.
execute_before_dh_auto_configure:
	sh scripts/distro-prep.sh

override_dh_auto_install:
	dh_auto_install
	test -n "$$(find debian/python3-tetragon-client -path '*/tetragon_client/_pb/tetragon/events_pb2.py' -print -quit)" || { \
		echo 'Generated stubs were not installed' >&2; find debian -type f >&2; exit 1; }
	! find debian/python3-tetragon-client -name '*.pyi' -path '*/_pb/*' | grep -q .
