#!/usr/bin/make -f

export DH_VERBOSE=1
export PYBUILD_INSTALL_DIR=/usr/share/vitables/
export PYBUILD_TEST_ARGS="-k not test_l10n"

# Ensure tests are run with PyQt6
export QT_API=pyqt6

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_clean:
	$(MAKE) -C doc clean

execute_after_dh_auto_build:
	$(MAKE) -C doc html # generate doc/index.rst
	$(MAKE) -C doc qthelp
	cd doc/_build && rm -r html && mv qthelp html && rm html/_static/*.js

execute_before_dh_install:
	mv $(CURDIR)/debian/vitables/usr/bin/vitables $(CURDIR)/debian/vitables/usr/share/vitables/vitables-run

execute_after_dh_install:
	dh_install -p vitables vitables/icons/{??x??,vitables*} usr/share/vitables/icons

execute_after_dh_fixperms:
	chmod -x $(CURDIR)/debian/vitables/usr/share/vitables/vitables/start.py
