#!/usr/bin/make -f

export HOME=$(CURDIR)/debian/tmp-home
export CONFIGDIR=$(shell dbus-run-session python -c "import keyring.util.platform_; print(keyring.util.platform_.config_root())")

%:
	dh $@ --with python2,translations --fail-missing

# Disabled because python-qt4reactor not in main
#override_dh_auto_test:
#	./run-tests || true

override_dh_clean:
	rm -rf $(HOME)
	dh_clean

override_dh_auto_configure:
	mkdir -p $(HOME)
	mkdir -p $(CONFIGDIR)
	cp $(CURDIR)/debian/keyringrc.cfg $(CONFIGDIR)/
	sed -i 's,@PATH@,$(CONFIGDIR),' $(CONFIGDIR)/keyringrc.cfg
	dh_auto_configure

override_dh_auto_install:
	dh_auto_install
	# These are actually compiled into code or the Qt scripts directly
	rm -rf debian/tmp/usr/share/ubuntu-sso-client
	rm -rf debian/tmp/usr/lib/python*/dist-packages/*/*.egg-info
	rm -f debian/tmp/usr/share/doc/ubuntu-sso-client/README*

