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

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

%:
	dh $@ --with python2

override_dh_auto_test:
	# Cannot run the test suites at build time since they depend on Tryton
	# being configured, with for example a user for the database, etc.

override_dh_auto_build:
	@

override_dh_auto_install:
	dh_auto_install
	# Remove the qr code module (dependency currently not satisfied in Debian)
	find debian -name "health_qrcodes" -type d -prune -execdir rm -r \{\} \;
	# Mark all the Python scripts executable
	find debian -name "*.py"  -type f -executable -exec chmod a-x \{\} \;
	# Remove all the tests folders from the binary package
	find debian -name "tests" -type d -prune -execdir rm -r \{\} \;

override_dh_link:
	## workaround for "extra-license-file":
	$(foreach FL,$(shell find debian -name 'COPYING' -type f), \
          $(shell $(RM) "$(FL)" && ln -s /usr/share/common-licenses/GPL-3 "$(FL)"))
	dh_link

override_dh_builddeb:
	dh_builddeb -- -Zxz
