#!/usr/bin/make -f
#
# Build Debian package using https://github.com/spotify/dh-virtualenv
#
# Note that this only works after applying
#   https://github.com/spotify/dh-virtualenv/pull/43
# (at least with some versions of virtualenv)

# The below targets create a clean copy of the workdir via
# using "sdist", else "pip" goes haywire when installing from
# sourcedir ".", because that includes the debian build stage,
# and a recursive explosion ensues when symlinks are followed.

clean:
	test ! -d dist || rm -rf dist
	test ! -d debian/sdist || rm -rf debian/sdist
	dh $@ --with python-virtualenv

build:
	python setup.py sdist --formats zip
	unzip -d debian/sdist dist/*.zip
	dh $@ --with python-virtualenv --sourcedir debian/sdist/*

%:
	dh $@ --with python-virtualenv --sourcedir debian/sdist/*
