#!/usr/bin/make -f

%:
	dh $@ --with python3

# python3 needs some manual work
override_dh_python3:
	dh_python3 --no-guessing-deps --shebang=/usr/bin/python3

override_dh_auto_clean:
	set -ex; for python in $(shell py3versions -r); do \
	    if [ -f python.py ]; then $$python setup.py clean; fi; \
	done
	rm -rf build
	find . -name __pycache__ -prune | xargs rm -rf

override_dh_auto_build:
	set -ex; for python in $(shell py3versions -r); do \
	    $$python setup.py build ; \
	done

override_dh_auto_install:
	set -ex; for python in $(shell py3versions -r); do \
	    $$python setup.py install --root=$(CURDIR)/debian/gtranscribe --install-layout=deb ; \
	done

override_dh_install:
	dh_install
	# remove README as it's installed in the wrong directory
	rm -rf $(CURDIR)/debian/gtranscribe/usr/share/doc/gTranscribe
