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

export PYBUILD_NAME=requirements-detector

VERSION := $(shell dpkg-parsechangelog -Sversion | cut -d- -f1)
DEBDATE := $(shell dpkg-parsechangelog -Sdate | date -u +"%F" -f -)

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

override_dh_auto_install:
	dh_auto_install
	rm -rf debian/python-requirements-detector/usr/bin

override_dh_auto_test:
	PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="LC_ALL=C.UTF-8 {interpreter} -m nose --verbose" dh_auto_test

override_dh_installdocs:
	dh_installdocs -A README.md

override_dh_installman:
	txt2man -s 1 -v "python3-requirements-detector" -t "detect-requirements" \
	-r "$(VERSION)" -d "$(DEBDATE)" debian/detect-requirements.txt > .pybuild/detect-requirements.1
	dh_installman -ppython3-requirements-detector .pybuild/detect-requirements.1
