#!/usr/bin/make -f
#export DH_VERBOSE=1
#export DEB_BUILD_OPTIONS=nocheck

%:
	dh $@ --with python2

.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

