#!/usr/bin/make -f

VERSION=$(shell head -n 1 debian/changelog | cut -f2 -d " " | tr -d "()" | cut -f1 -d "-")
APP=go2
ORIG_REPO=hg clone http://hg.savannah.nongnu.org/hgweb/go2
ORIG_DIR=$(APP)-$(VERSION)
EXCLUDE=--exclude=debian --exclude=\*~ --exclude=.hg --exclude=.svn --exclude=\*.pyc

%:
	dh $@ --with=python2

override_dh_auto_build:
	dh_auto_build
	rst2man go2.rst > go2.1

override_dh_auto_clean:
	dh_auto_clean
	-$(RM) go2.1

get-orig-source:
	$(ORIG_REPO) $(ORIG_DIR)
	tar $(EXCLUDE) -czf $(APP)_$(VERSION).orig.tar.gz $(ORIG_DIR)
	$(RM) -r $(ORIG_DIR)
