#!/usr/bin/make -f

%:
	dh $@ --with python2,sphinxdoc

override_dh_auto_build:
	dh_auto_build
	python setup.py doc

override_dh_auto_install:
	dh_auto_install -ppython-pycassa --destdir=debian/python-pycassa

override_dh_installchangelogs:
	dh_installchangelogs CHANGES

override_dh_compress:
	dh_compress -X pycassa-doc/manual

PACKAGE = pycassa
SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.gz
get-orig-source:
	rm -rf get-orig-source $(TARBALL)
	mkdir get-orig-source
	git clone git://github.com/$(PACKAGE)/$(PACKAGE).git get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig
	cd get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig ; git reset --hard v$(SRC_VERSION)
	rm -rf get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig/.git
	rm -rf get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig/debian
	GZIP=--best tar czf $(TARBALL) -C get-orig-source $(PACKAGE)-$(SRC_VERSION).orig
	rm -rf get-orig-source
	echo "  "$(TARBALL)" created; move it to the right destination to build the package"

.PHONY: get-orig-source
