#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

# Prevent setup.py from downloading
export http_proxy = http://127.0.9.1:9

# one rule to rule them all ...
%:
	dh $@ --buildsystem=python_distutils --with python2

override_dh_auto_build:
	dh_auto_build
	# and docs
	$(MAKE) -C doc html
	# but remove jquery copy (later on link to Debian's version)
	-rm doc/build/html/_static/jquery.js
	-rm doc/build/html/_static/underscore.js
	# objects inventory is of no use for the package
	-rm doc/build/html/objects.inv
	: # also doc source files only consume space
	-rm -r doc/build/html/_sources

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG.rst

# enable when we believe that the tests should pass
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -e; for buildver in $(shell pyversions -vr); do \
		echo "I: Running spykeutils unittests using python$$buildver"; \
		python$$buildver /usr/bin/nosetests spykeutils || exit 1 ;\
	done
endif

## immediately useable documentation
## and exemplar data (they are small excerpts anyway)
override_dh_compress:
	dh_compress -X.py -X.html -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -X.par -X.bin

override_dh_auto_clean:
	dh_auto_clean
	-rm -rf doc/build build
	-rm -rf spykeutils.egg-info