#!/usr/bin/make -f
#export DH_VERBOSE=1
package=python-weberror
PYVERS=$(shell pyversions -vr)

clean:
	dh_testdir
	dh_testroot
	rm -rf build build-* tests/reporter_output/test_logger.log
	find . -name *\.py[co] -exec rm -f {} \;
	dh_clean install-stamp test-stamp install-python*

build:
build-indep:
build-arch:

install: install-stamp
install-stamp: $(PYVERS:%=install-python%)
	dh_install
	touch $@

install-python%:
	python$* setup.py install \
		--install-layout=deb \
		--single-version-externally-managed \
		--root $(CURDIR)/debian/$(package)
	touch $@

test: $(PYVERS:%=test-python%)

test-python%:
	-
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	python$* setup.py nosetests --quiet
endif

binary-indep: build install test
	dh_testdir
	dh_testroot
	dh_installchangelogs CHANGELOG
	dh_installdocs
	dh_strip
	dh_compress -X.py
	dh_fixperms
	dh_python2
	find debian/$(package) -type f -perm 755 | xargs -r chmod 644
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch:

binary: binary-indep binary-arch
.PHONY: build build-indep build-arch test clean binary-indep binary-arch binary install

