#!/usr/bin/make -f

#export DH_VERBOSE=1
export PYBUILD_NAME=pydl
export http_proxy=127.0.0.1:9

LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
BUILD_DATE  = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
SPHINXOPTS := -D html_last_updated_fmt="$(BUILD_DATE)" -D html_show_copyright=0

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

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. sphinx-build $(SPHINXOPTS) -N -bhtml docs/ build/html

override_dh_auto_clean:
	dh_auto_clean
	rm -rf api
	rm -rf .cache
	rm -f pydl/version.py
	rm -f .travis.yml
	rm -f MANIFEST.in
	rm -f pip-requirements

override_dh_auto_test:
	python setup.py test
	python3 setup.py test
