#!/usr/bin/make -f
# -*- makefile -*-
export DH_VERBOSE=1
export PYBUILD_NAME=isso

RJS = /usr/bin/nodejs /usr/lib/nodejs/r.js

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

rm_js_symlinks:
	echo "Removing built JS libraries"
	rm -f ./isso/js/count.min.js
	rm -f ./isso/js/embed.min.js

override_dh_auto_build:
	RJS="$(RJS)" dh_auto_build
	PYTHONPATH=. http_proxy='http://127.0.0.1:9/' sphinx-build -N -q -E -bhtml docs build/html

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	dh_sphinxdoc -p isso
endif

override_dh_installchangelogs:
	dh_installchangelogs CHANGES.rst

override_dh_auto_install:
	dh_auto_install
	pybuild --install -i python{version} -p 2.7 --dir . --verbose --test-nose

override_dh_auto_clean: rm_js_symlinks
	dh_auto_clean
