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

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

include /usr/share/python/python.mk

build: build-stamp
build-stamp:
	dh_testdir

	python setup.py build
	touch $@

clean:
	dh_testdir
	dh_testroot

	python setup.py clean
	rm -rf build/ TracMercurial.egg-info/

#	If we're not in a mercurial repository, make sure no hg metadata is
#	lying around
	if ! [ -d .hg ]; then \
		rm -f .hg*; \
	fi

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	python setup.py install --root="$(CURDIR)/debian/trac-mercurial" \
	    --no-compile $(py_setup_install_args)


# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_compress
	dh_fixperms
	dh_pysupport
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb


# Build architecture-dependent files here.
binary-arch: build install
#	Nothing to do

# For using debian/patches with Mercurial Queues
.PHONY: .hg/patches debian/patches
.hg/patches:
	dh_testdir
	rsync -av --delete debian/patches/ .hg/patches/
debian/patches:
	dh_testdir
	rsync -av --delete .hg/patches/ debian/patches/
	rm -f debian/patches/status

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
