#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# detect if build targets experimental suite (or is a draft)
DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

# avoid shipping sandbox test files
export DH_OPTIONS = -O--buildsystem=pybuild

BROKEN_TESTFILES = \
 tests/test_doctests.py \
 tests/test_timeout.py
BROKEN_TESTS = \
 test_audio_transcode \
 test_container_probing \
 test_context_manager \
 test_data \
 test_decode_audio_sample_count \
 test_decoded_motion_vectors \
 test_decoded_time_base \
 test_decoded_video_frame_count \
 test_decode_half \
 test_deprecated_stream_seek \
 test_encoding \
 test_movtext \
 test_parse \
 test_reading \
 test_seek_end \
 test_seek_float \
 test_seek_int64 \
 test_seek_middle \
 test_seek_start \
 test_selection \
 test_stream_probing \
 test_stream_seek \
 test_stream_tuples \
 test_vobsub
export PYBUILD_TEST_ARGS = \
 $(patsubst %,--ignore=%,$(BROKEN_TESTFILES)) \
 -k 'not $(subst $() , and not ,$(strip $(BROKEN_TESTS)))' \
 $(if $(DEB_SUITE_EXP),|| true)

# avoid shipping sandbox test files
override_dh_auto_install:
	dh_auto_install
	find debian/*/usr/lib -path '*/sandbox*' -delete

%:
	dh $@
