#!/usr/bin/make -f

.PHONY: override_dh_auto_install
override_dh_auto_install:
	dh_auto_install
	cd debian/pybtex/usr/bin && mv pybtex bibtex.pybtex
	for module in tests docgen; do \
	rm -Rf debian/pybtex/usr/lib/python*/*-packages/pybtex/$$module/; \
	done
	rm -f debian/pybtex/usr/lib/python*/*-packages/*.egg-info/requires.txt

.PHONY: override_dh_installman
override_dh_installman:
	dh_installman
	cd debian/pybtex/ && rename.ul pybtex bibtex.pybtex usr/share/man/man*/pybtex.[0-9]

.PHONY: override_dh_auto_test
override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	set -e; \
	for python in $(shell pyversions -r); do \
		$$python setup.py nosetests; \
	done
endif

.PHONY: override_dh_installchangelogs
override_dh_installchangelogs:
	elinks -config-file /dev/null -dump -no-numbering -no-references docs/html/history.html \
	| grep -A1000 ^Version \
	| sed -e '/ *-\{50,\}- *$$/ { s///; q }' \
	> docs/changelog
	dh_installchangelogs docs/changelog

.PHONY: build build-arch build-indep binary binary-arch binary-indep clean
build build-arch build-indep binary binary-indep clean:
	dh $(@)
# In order not to confuse lintian, binary-arch is a separate target:
binary-arch:

# vim:ts=4 sw=4 noet
