#!/usr/bin/make -f

export PYBUILD_NAME=watchdog

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

override_dh_clean:
	dh_clean
	rm -rf docs/build .pytest_cache .coverage .pybuild

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	python3 -m sphinx -b man docs/source docs/build/man
	sed -i 's/.TH "WATCHDOG" "1"/.TH "WATCHDOG" "3"/g' docs/build/man/watchdog.1
	cp -f docs/build/man/watchdog.1 docs/build/man/watchdog3.1
	PYTHONPATH=. python3 -m sphinx -b html docs/source $(CURDIR)/debian/python-watchdog/usr/share/doc/python-watchdog/html
	PYTHONPATH=. python3 -m sphinx -b html docs/source $(CURDIR)/debian/python3-watchdog/usr/share/doc/python3-watchdog/html
	dh_sphinxdoc -O--buildsystem=pybuild
endif

override_dh_installdocs:
	dh_installdocs
	dh_installdocs -A AUTHORS
