#!/usr/bin/make -f
VERSION = $(shell dpkg-parsechangelog |  sed -rne "s,^Version: ([0-9.]+)(~|-)(.*),\1,p")

%:
	dh $@ --with python2 --with python3 --buildsystem=python_distutils

override_dh_installdocs:
	help2man --name=autopep8  --version-string=$(VERSION) "python autopep8.py" > debian/autopep8.1
	dh_installdocs

override_dh_auto_build:
	python setup.py build --force
	python3 setup.py build --force

override_dh_auto_install:
	python setup.py install --force --root=$(CURDIR)/debian/python-autopep8 --no-compile -O0 --install-layout=deb
	python3 setup.py install --force --root=$(CURDIR)/debian/python3-autopep8 --no-compile -O0 --install-layout=deb
	rm -rf $(CURDIR)/debian/python3-autopep8/usr/bin

#override_dh_auto_test:
#	make test
#	dh_auto_test

override_dh_clean:
	rm -f debian/*.1
	rm -rf build
	dh_clean
