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

export PYBUILD_NAME=pyramid
export pkgversion=$(shell dpkg-parsechangelog --show-field version)

%:
	dh $@ --with python3 --buildsystem=pybuild


override_dh_auto_install:
	dh_auto_install
	cd $(CURDIR)/debian/python3-pyramid/usr/bin; \
	for file in * ; do \
	    mv $${file} $${file}3; \
	done
	find $(CURDIR)/debian -name \*.pdf -exec chmod -x {} \;


override_dh_installman:
	mkdir -p $(CURDIR)/debian/manpages3
	export PYTHONPATH=$(CURDIR)/debian/python3-pyramid/usr/lib/$(shell py3versions -d)/dist-packages; \
	cd $(CURDIR)/debian/python3-pyramid/usr/bin; \
	set -x; \
	for file in *; do \
	    help2man --version-string=$${pkgversion} \
		     --no-info --section=1 \
		     --name="Python 3 Pyramid command" \
		     --output=$(CURDIR)/debian/manpages3/$${file}.man \
		     --no-discard-stderr \
		     ./$${file}; \
	done
	dh_installman


override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(CURDIR)/debian/manpages3