#!/usr/bin/make -f
%:
	dh --with python-central $@

override_dh_auto_clean:
	rm -f AptUrl/Version.py

override_dh_auto_install:
	python ./setup.py install --prefix=$(CURDIR)/debian/tmp/usr

override_dh_install:
	dh_install --sourcedir=debian/tmp --fail-missing


PKG=apturl
DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)

arch-build:
	rm -rf debian/arch-build
	mkdir -p debian/arch-build/$(PKG)-$(DEBVER)
	tar -c --exclude=arch-build --no-recursion -f - `bzr inventory` | (cd debian/arch-build/$(PKG)-$(DEBVER);tar xf -)
	(cd debian/arch-build/$(PKG)-$(DEBVER) && $(DEB_BUILD_PROG))
