#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PYVERS=$(shell pyversions -vs)

%:
	dh $@ --with python2 --with sphinxdoc --buildsystem=python_distutils


override_dh_auto_build:
	$(MAKE)
	mv doc/usersguide-?.?.?.pdf doc/usersguide.pdf
	dh_auto_build --buildsystem=python_distutils


override_dh_auto_clean:
	dh_auto_clean --buildsystem=python_distutils
	$(MAKE) distclean
	rm -f doc/*.pdf


override_dh_sphinxdoc:
	dh_sphinxdoc -ppython-tables-doc


override_dh_installchangelogs:
	dh_installchangelogs RELEASE_NOTES.txt


override_dh_compress:
	dh_compress -X.txt -X.pdf -X.py -X.h5


override_dh_auto_install:
	dh_auto_install
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e; \
	for v in $(PYVERS); do \
		cd "$(CURDIR)/debian/tmp/usr/lib/python$$v/dist-packages/"; \
		python$$v -c "import tables; tables.test()"; \
	done
endif


.PHONY: override_dh_auto_build override_dh_auto_clean override_dh_sphinxdoc \
        dh_auto_install override_dh_installchangelogs override_dh_compress
