#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
package=python-myghty
PYVERS=$(shell pyversions -vr)

-include /usr/share/python/python.mk
ifeq (,$(py_libdir))
	    py_libdir = /usr/lib/python$(subst python,,$(1))/site-packages
	endif

clean:
	rm -f build-*
	dh_testdir
	dh_testroot
	rm -rf build
	find . -name \*.py[co] -exec rm -f {} \;
	rm -Rf lib/*.egg-info
	rm -f doc/html/*html
	dh_clean

build: build-indep

build-indep:
	cd doc; python ./genhtml.py
	touch $@

build-stamp: 
	dh_testdir
	python setup.py build
	touch $@

install: $(PYVERS:%=install-python%)
install-python%:
	dh_installdirs
	python$* setup.py install \
		--no-compile $(py_setup_install_args) \
		--single-version-externally-managed \
		--root $(CURDIR)/debian/$(package)
	cp -a doc/html/* $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/html
	cp -a examples/* $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/examples
	find debian/$(package)/usr/share/doc/$(package)/examples -name \*.py -exec sed -i -e '1 s|/usr/local/|/usr/|' {} \;

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_installchangelogs CHANGES
	dh_installdocs
	dh_installexamples
	dh_pysupport
	dh_compress -X.py
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb -- -Z bzip2

binary-arch:

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