#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

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

override_dh_auto_install:
	python3 -m pip install --no-deps --no-build-isolation --root=$(CURDIR)/debian/scantpaper --prefix=/usr .
	# dh_auto_install will still place any additional files; ensure dh runs
	dh_auto_install --destdir=$(CURDIR)/debian/scantpaper || true
	rm -rf $(CURDIR)/debian/scantpaper/usr/local || true # FIXME: there has to be a better way to prevent pip from installing to /usr/local
	# install locale files
	# can't directly install to /usr/share/locale since pybuild seems to delete them
	python3 $(CURDIR)/dev/compile_mo.py --src $(CURDIR)/po --out $(CURDIR)/locale --domain scantpaper || true
	mkdir -p $(CURDIR)/debian/scantpaper/usr/share
	cp -a $(CURDIR)/locale $(CURDIR)/debian/scantpaper/usr/share/

# https://people.debian.org/~eriberto/README.package-tests.html
override_dh_auto_test: ;
