#!/usr/bin/make -f

PYTHON2=$(shell pyversions -vr)

%:
	dh $@ --with python2,sphinxdoc

.PHONY: override_dh_auto_build
override_dh_auto_build:
	# Build everything else
	dh_auto_build
	# Build sphinx documentation
	python setup.py build_sphinx
	# Remove the .buildinfo file that is of no use to the end users
	$(RM) build/sphinx/html/.buildinfo

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	# Remove everything else
	dh_auto_clean
	# Remove build directory with sphinx files
	$(RM) -r json_schema_validator.egg-info build setup.cfg

.PHONY: override_dh_compress
override_dh_compress:
	# Do not compress .js files generated by sphinx
	dh_compress -X.js

.PHONY: override_dh_auto_test

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
test-python%:
	python$* setup.py test -vv

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