#!/usr/bin/make -f

#export DH_VERBOSE = 1
export PYBUILD_INSTALL_ARGS=--install-lib=/usr/lib/python3/dist-packages
# pytest-asyncio is not packaged yet
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_clean:
	dh_clean
	rm -rf aiofiles.egg-info

override_dh_install:
	dh_install
	rm -rf debian/python3-aiofiles/usr/lib/python3/dist-packages/aiofiles/__pycache__
	rm -rf debian/pythoni3-aiofiles/usr/lib/python3/dist-packages/aiofiles/threadpool/__pycache__

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)

