#!/usr/bin/make -f

DH_VERBOSE := 1

DEBVERS        := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
VERSION        := $(shell echo '$(DEBVERS)' | sed -e 's/^[0-9]*://' -e 's/-.*//')

export PYBUILD_NAME=schema-salad
export PYBUILD_DISABLE=test

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

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=$(shell echo .pybuild/*/build/) help2man --no-info \
		   --version-string=${VERSION} \
		--name="Schema Annotations for Linked Avro Data (SALAD)" \
		python\ schema_salad/main.py > debian/schema-salad-tool.1
	sed -i 's/main.py/schema-salad-tool/g' debian/schema-salad-tool.1
	sed -i 's/MAIN.PY/SCHEMA-SALAD-TOOL/g' debian/schema-salad-tool.1

override_dh_auto_clean:
	rm -f debian/*.1
