#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export PYBUILD_NAME=cron-descriptor
export PYBUILD_TEST_ARGS=tests/*.py

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_auto_build:
	set -e; \
	for loc in cron_descriptor/locale/*.po; do msgfmt --check $$loc -o $$(echo $$loc |sed 's,\.po$$,.mo,'); done

execute_before_dh_installman:
	PYTHONPATH=$(CURDIR) argparse-manpage \
		--pyfile $(CURDIR)/cron_descriptor/__main__.py \
		--function get_parser \
		--prog cron-descriptor \
		--format pretty \
		--project-name "Cron Descriptor" \
		--version $(DEB_VERSION_UPSTREAM) \
		--description "Convert cron expressions into human readable strings" \
		--author "Adam Schubert" \
		--url https://github.com/Salamek/cron-descriptor \
		--output $(CURDIR)/cron-descriptor.1
