#!/usr/bin/make -f

DEBVERS         ?= $(shell dpkg-parsechangelog -SVersion)
VERSION         ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//')
DEBPKGNAME      ?= $(shell dpkg-parsechangelog -SSource)
GIT_TAG         ?= $(shell echo '$(VERSION)' | sed -e 's/~/_/')

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

override_dh_auto_test:
	$(MAKE) test-unit

clean:
	dh_clean asciinema.egg-info/ asciinema/commands/__pycache__/ tests/__pycache__/ asciinema/__pycache__/ .pybuild/

# taken from openstack-pkg-tools
gen-orig-gz:
	git tag -v $(GIT_TAG) || true
	if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ] ; then \
		git archive --prefix=$(DEBPKGNAME)-$(VERSION)/ v$(GIT_TAG) | gzip >../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ; \
	fi
