#!/usr/bin/make -f

export PYTHONWARNINGS=d
export PYTHONPATH=.

python_all = pyversions -r | tr ' ' '\n' | xargs -t -I {} env {}

.PHONY: clean
clean:
	dh_testdir
	dh_clean
	rm -rf build
	find -name '*.py[co]' -delete

.PHONY: build build-arch build-indep
build build-indep: build/stamp

build/stamp:
	dh_testdir
ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ""
	$(python_all) debian/run-tests.py
endif
	$(python_all) setup.py build
	sed -n -r -e 's/^ {8}//p' PKG-INFO > build/README
	touch $(@)

.PHONY: binary binary-arch binary-indep
binary binary-indep: build/stamp
	dh_testdir
	dh_testroot
	dh_prep
	$(python_all) setup.py install --prefix=/usr --root=debian/python-byteplay/
	sed -i 's/^Metadata-Version: 1\.0$$/Metadata-Version: 1.1/' debian/*/usr/lib/python2.*/*-packages/*.egg-info
	dh_installdocs build/README
	dh_installexamples examples/*.py
	dh_installchangelogs
	dh_pysupport
	dh_compress -X examples
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# vim:ts=4 sw=4 noet
