#!/usr/bin/make -f
# -*- makefile -*-

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

# install straight into the package (pybuild defaults to debian/tmp), with the
# module in a private location, /usr/share/tvnamer/
export PYBUILD_DESTDIR=debian/tvnamer
export PYBUILD_INSTALL_DIR=/usr/share/
# the functional tests and test_name_generation_on_testfiles query thetvdb.com;
# the functional mark is registered in upstream's pytest.ini, not in the tarball
export PYBUILD_TEST_ARGS=-o markers=functional -m 'not functional' -k 'not test_name_generation_on_testfiles'

%:
	dh $@ --buildsystem=pybuild

override_dh_clean:
	dh_clean
	rm -rf build
	rm -rf tvnamer.egg-info

override_dh_auto_install:
	dh_auto_install
	# the private location is not on sys.path: drop the wheel metadata, and
	# replace the generated entry point with a wrapper that adds it
	rm -r debian/tvnamer/usr/share/tvnamer-*.dist-info
	install -m 755 debian/tvnamer.py debian/tvnamer/usr/bin/tvnamer

override_dh_installdocs:
	dh_installdocs README.md
