#!/usr/bin/make -f
#DH_VERBOSE = 1

export PYBUILD_NAME = ofxstatement-plugins

%:
	dh $@ --with python3

PLUGINS=$(wildcard ofxstatement-*)

plugin_clean_% : %
	cd $< && python3 setup.py clean
	rm -f $</$<.README.rst

plugin_build_% : %
	cd $< && python3 setup.py build
	test ! -e $</README.rst || cp $</README.rst $</$<.README.rst

plugin_install_% : %
	cd $< && python3 setup.py install \
		--force --root=$(CURDIR)/debian/ofxstatement-plugins \
		--no-compile -O0 --install-layout=deb
	test ! -e $</$<.README.rst || dh_installdocs $</$<.README.rst
	

plugin_test_% : %
	cd $< && python3 setup.py test


override_dh_auto_clean: $(addprefix plugin_clean_,$(PLUGINS))
	rm -rf ofxstatement-postfinance/build \
		ofxstatement-postfinance/src/ofxstatement_postfinance.egg-info
override_dh_auto_build: $(addprefix plugin_build_,$(PLUGINS))
override_dh_auto_install: $(addprefix plugin_install_,$(PLUGINS))
#override_dh_auto_test: $(addprefix plugin_test_,$(PLUGINS))

