#!/usr/bin/make -f

#export DH_VERBOSE=1

%:
	dh $@ --buildsystem pybuild --with bash-completion,python3

override_dh_auto_build:
	dh_auto_build
	make -C doc html SPHINXBUILD=/usr/share/sphinx/scripts/python3/sphinx-build
	make -C doc man SPHINXBUILD=/usr/share/sphinx/scripts/python3/sphinx-build

override_dh_auto_install:
	# Work around missing global options support: https://bugs.debian.org/890906
	HOME=$(wildcard .pybuild/pythonX.Y_3*) python3 ./setup.py --salt-state-dir=/var/lib/salt install --root $(CURDIR)/debian/tmp

override_dh_auto_clean:
	make -C doc clean
	dh_auto_clean

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	python3 ./tests/runtests.py -v --no-report --unit
endif

override_dh_install:
	dh_install -X/usr/share/man/man

override_dh_fixperms:
	dh_fixperms
	chmod 2750 debian/salt-common/var/log/salt
	chown root:adm debian/salt-common/var/log/salt

override_dh_missing:
	dh_missing -X/usr/share/man/man --fail-missing
