#! /usr/bin/make -f

# Place streamlink executable in the correct place right away.
export PYBUILD_INSTALL_ARGS_python3 = --install-scripts usr/share/streamlink/

# Debian has a python3-pycountry package but not a iso639 package so use
# pycountry.
export STREAMLINK_USE_PYCOUNTRY=1

# Provides DEB_VERSION
include /usr/share/dpkg/pkg-info.mk

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

override_dh_auto_install:
	python3 setup.py build_sphinx -b man
	python3 setup.py build_sphinx -b html
	dh_auto_install
	# Call dh_link here so symlinks (like modernizer) are available when dh_sphinxdoc
	# is run. dh_sphinxdoc will do a sanity check that check that js scripts
	# referenced by search.html exist.
	dh_link

# Explicitly uses CHANGELOG.md instead of docs/changelog.md (the default
# file used by dh_installchangelogs)
override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG.md

# Needed to prevent docs/changelog.html from being compressed
override_dh_compress:
	dh_compress -X.html
