#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

override_dh_auto_build:
	dh_auto_build
	# Generate documentation and manpages.
	PYTHONPATH=. http_proxy='127.0.0.1:9' \
		sphinx-build -N -b html docs build/html
	PYTHONPATH=. http_proxy='127.0.0.1:9' \
		sphinx-build -N -b man docs build/man
	mv build/man/hdfcompass.1 build/man/HDFCompass.1
	# Correct and stage desktop file.
	sed 's/\r//g' HDFCompass.desktop > build/HDFCompass.desktop
	# Generate application icon.
	icotool -x HDFCompass.ico -w 256 -o build/HDFCompass.png

override_dh_auto_test:
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="{interpreter} -m unittest \
		hdf_compass.array_model.test \
		hdf_compass.asc_model.test \
		hdf_compass.filesystem_model.test \
		hdf_compass.hdf5_model.test" \
		dh_auto_test

override_dh_install:
	dh_install --exclude=license.txt

override_dh_compress:
	dh_compress --exclude=examples
