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

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

PACKAGE_NAME := $(shell dpkg-parsechangelog | sed -n -e's/^Source: \(.*\)\+/\1/p')
UVERSION := $(shell dpkg-parsechangelog | sed -n -e's/^Version: \(.*\)-[^-]\+/\1/p' | cut -d ":" -f 2)
export PYBUILD_NAME=$(PACKAGE_NAME)

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

override_dh_clean:
	dh_clean
	rm -rf doc/_build/

override_dh_installdocs:
	cd doc; \
	make html; \
	cd -;
	sed "s@http://sflogo.sourceforge.net/sflogo.php@@g" -i doc/_build/html/index.html
	dh_installdocs

get-orig-source:
	@if [ ! -d "debian" ] ; then \
		echo 'Run this from the top directory of the Debian source' >&2; \
		exit 1; \
	fi
	wget https://pypi.python.org/packages/source/Y/Yapsy/Yapsy-$(UVERSION).tar.gz \
		-O ../$(PACKAGE_NAME)_$(UVERSION).orig.tar.gz
