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

#export DH_VERBOSE=1
export DH_OPTIONS

export PYBUILD_NAME=sense-emu

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

override_dh_auto_build:
	dh_auto_build
	$(MAKE) -C icons/
	PYTHONPATH=. sphinx-build -N -bhtml docs/ build/html
	PYTHONPATH=. sphinx-build -N -bman docs/ build/man

override_dh_auto_install:
	dh_auto_install
	# Strip out binaries from the library packages (and move the py3 ones
	# into the sense-emu-tools package)
	rm -fr debian/python-sense-emu/usr/bin
	mkdir -p debian/sense-emu-tools/usr/bin
	mv debian/python3-sense-emu/usr/bin/* debian/sense-emu-tools/usr/bin/
	rmdir debian/python3-sense-emu/usr/bin
	# Strip out compiled gschemas from everything (it's handled by the
	# .install file and is only included in the source distro for
	# development purposes and odd platforms like Windows)
	find debian/ -name "gschemas.compiled" -delete

override_dh_auto_test:
	# Don't try and find any tests ... because there aren't any!

override_dh_installdocs:
	dh_installdocs --doc-main-package=python3-sense-emu -ppython-sense-emu-doc
	dh_installdocs -ppython3-sense-emu
	dh_installdocs -psense-emu-tools
