#! /usr/bin/make -f

#export DH_VERBOSE = 1
export PYBUILD_NAME = m3u8

PYTHONS:=$(shell pyversions -vr)
PYTHON3S:=$(shell py3versions -vr)

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

override_dh_installchangelogs:
	dh_installchangelogs $(CURDIR)/debian/CHANGELOG

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	set -e ; \
	python tests/m3u8server.py >/dev/null 2>&1 & \
	PID=$$! ; \
	for pyvers in $(PYTHONS); do \
		PYTHONPATH=. python$$pyvers -m pytest -vv tests/ ; \
	done ; \
	for pyvers in $(PYTHON3S); do \
		PYTHONPATH=. python$$pyvers -m pytest -vv tests/ ; \
	done ; \
	kill -9 $$PID
endif
