#!/usr/bin/make -f

export DH_VERBOSE=1
export DH_ALWAYS_EXCLUDE=__pycache__
export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/ytcc --install-scripts=/usr/share/ytcc

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

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# exclude internet tests
	# pytest --deselect does pattern matching so *all* test_subscribe* are deselected...
	sed -i -e '/test_subscribe(/i @pytest.mark.skip()' \
	       -e '/test_import(/i @pytest.mark.skip()' \
	       -e '/test_import_duplicate(/i @pytest.mark.skip()' \
	       -e '/test_update(/i @pytest.mark.skip()' \
	       -e '/test_download(/i @pytest.mark.skip()' \
	       -e '/test_play_video(/i @pytest.mark.skip()' \
	       $(CURDIR)/test/test_cli.py
	dh_auto_test
endif

override_dh_auto_clean:
	sed -i '/@pytest.mark.skip/d' $(CURDIR)/test/test_cli.py
	dh_auto_clean
