#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ --with python2

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# custom tests
	set -e \
	;for python in $(shell pyversions -r); do \
	    for test in $(wildcard ./webm/tests/*_tests.py); do \
	        PYTHONPATH=".:$(PYTHONPATH)" \
	        $$python $${test} \
	    ;done \
	;done
	# all tests
	nosetests -s -x -v
endif

LIBWEBP=$(shell python -c 'from ctypes.util import find_library; print find_library("webp")')
LIBWEBP_PKG=$(shell dpkg-query --search $(LIBWEBP) | head -1 | sed 's/:.*//')
override_dh_gencontrol:
	$(info I: $(LIBWEBP_PKG): $(LIBWEBP))
	dh_gencontrol -v -- -Vmy:Depends="$(LIBWEBP_PKG)"

override_dh_builddeb:
	dh_builddeb -- -Zxz
