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

export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/shoogle
export PYBUILD_DISABLE=test

PKD = $(word 1,$(abspath $(dir $(MAKEFILE_LIST))))
PKG = $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source)
VER ?= $(shell (dpkg-parsechangelog -l$(PKD)/changelog | grep Version | sed 's/Version..//' | sed 's/-.\+//'))

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


override_dh_auto_build:
	dh_auto_build -O--buildsystem=pybuild
	pandoc debian/shoogle.1.md -s -t man -o debian/shoogle.1

.PHONY get-orig-source:
get-orig-source:  $(info I: $(PKG)_$(VER))
	@echo "# Downloading..."
	uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
	mv $(PKG)-$(VER).tar.gz.pgp $(PKG)_$(VER).orig.tar.gz.asc

