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

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

#Allowing this to be overridden by environemnt helps with backports
DEB_PYTHON_SUPPORT?=python2

# Get the supported Python versions
PYVERS = $(shell pyversions -r -v)

%:
	dh $@ --with $(DEB_PYTHON_SUPPORT)

override_dh_auto_build:
	dh_auto_build
	$(MAKE) -C doc html

override_dh_auto_clean:
	dh_auto_clean
	$(MAKE) -C doc clean

#Fix Lintian warning about jquery.js
override_dh_installdocs:
	dh_installdocs -X.buildinfo

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e -x; \
	cd tests; \
	for py in $(PYVERS); do \
	    PYTHONPATH=$$( echo $(CURDIR)/build/lib.*-$$py ) python$$py all_tests.py ; \
	done
endif

#Don't compress .js files
override_dh_compress:
	dh_compress -X.js
