#!/usr/bin/make -f

#DH_VERBOSE=1

export PYBUILD_NAME=odfpy
PYTHON2=$(shell pyversions -vr)

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

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
test-python%:
	cd tests; \
	PYTHONPATH=../`python$* -c "import sys; print ':'.join(sys.path)"`; \
	for F in `ls test*.py` ; do \
		PYTHONPATH=$$PYTHONPATH python$* $$F; \
	done

override_dh_auto_test: $(PYTHON2:%=test-python%)
endif

override_dh_auto_build:
	for D in csv2ods mailodf odf2xhtml odf2mht odf2xml odfimgimport odflint odfmeta odfoutline odfuserfield xml2odf; do \
		( cd $$D && \
		rm $$D.1 && \
		$(MAKE) ) \
	done
	dh_auto_build
