#!/usr/bin/make -f

export PYBUILD_NAME=grapefruit

PYVERS :=  $(shell pyversions -r)
UPSTREAM = $(shell dpkg-parsechangelog | egrep '^Version: ' | cut -d ' ' -f 2- | sed 's/+dfsg.*//')

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

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=$(shell pwd) make -C doc/ html

override_dh_auto_clean:
	dh_auto_clean
	rm -rf docs/_build

override_dh_auto_test:
	set -ex; \
	for py in $(shell pyversions -r) $(shell py3versions -r); do \
		PYTHONPATH=$(CURDIR) $$py -m pytest; \
	done

get-orig-source:
	gzip -cd '../grapefruit_$(UPSTREAM).orig.tar.gz' | tar --delete doc/_static/GrapeFruit.png | gzip > '../grapefruit_$(UPSTREAM)+dfsg.orig.tar.gz'