#!/usr/bin/make -f

export PYBUILD_NAME=watchdog

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
%:
	dh $@ --buildsystem=pybuild

override_dh_sphinxdoc:
	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

else
%:
	dh $@ --buildsystem=pybuild
endif

execute_after_dh_clean:
	rm -rf docs/build .pytest_cache .coverage .pybuild

override_dh_auto_test:
	dh_auto_test -O--buildsystem=pybuild -- --test-pytest --test-args '-k "not test_unmount_watched_directory_filesystem"'
