#!/usr/bin/make -f

DEB_PYTHON_SYSTEM = pycentral

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk

DEB_PYTHON_INSTALL_ARGS_ALL += --install-data=/usr/share
DEB_PYTHON_BUILD_ARGS += --executable "/usr/bin/python"
DEB_COMPRESS_EXCLUDE += .svg .pdf

clean::
	$(MAKE) clean-docs
	rm -f bzr.1 debian/stamp-doc

ifneq (,$(findstring test,$(DEB_BUILD_OPTIONS)))
common-post-build-indep::
	./bzr selftest --no-plugins
endif

build/bzr:: debian/stamp-doc

debian/stamp-doc:
	$(MAKE) docs
	touch $@

install/bzr-doc::
# Install the documentation; since html and txt and intermixed
# under doc/, this is handier than trying to do it from bzr-doc.install. 
	for ext in txt html; do \
	    ( cd doc && find -name "*.$$ext" -print0 ) | \
	    	xargs -r0 -i'{}' -n1 install -D -m 644 'doc/{}' \
	    	"debian/bzr-doc/usr/share/doc/bzr/$$ext/{}"; \
	done
# Install images as well
	( cd doc && find -name "*.png" -print0 ) | \
	    xargs -r0 -i'{}' -n1 install -D -m 644 'doc/{}' \
	    "debian/bzr-doc/usr/share/doc/bzr/html/{}"
