#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@ --buildsystem=pybuild

# Upstream's test suite reads sample data via paths relative to the repo
# root (e.g. "sample/unicode-example-utf8.txt"), which breaks under
# pybuild's isolated per-interpreter build copy. Run it against the real
# source tree instead, same as upstream's own `make test`. The integration
# tests also exercise real curses via initscr(), which needs a pty; upstream
# itself runs its CI under script(1) for the same reason.
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd $(CURDIR) && TERM=xterm script -qec "PYTHONPATH=$(CURDIR) TERM=xterm python3 -W error -m unittest discover -v" /dev/null
endif
