#!/usr/bin/make -f

override_dh_auto_clean:
	rm -rf build fudge.egg-info
	find -name '._*' -delete
	dh_auto_clean

override_dh_auto_install:
	sphinx-build -b html -a -c docs docs \
		$(CURDIR)/debian/python-fudge-doc/usr/share/doc/python-fudge-doc/html
	python setup.py install --install-layout=deb \
	    --root $(CURDIR)/debian/python-fudge
	python3 setup.py install --install-layout=deb \
		--root $(CURDIR)/debian/python3-fudge

override_dh_python2:
	dh_python2 -ppython-fudge

override_dh_python3:
	dh_python3 -ppython3-fudge

override_dh_sphinxdoc:
	dh_sphinxdoc -ppython-fudge-doc

override_dh_compress:
	dh_compress -i -X.rst -X.js -X.html -X.txt

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
		set -e -x; \
		PYTHONPATH=$(CURDIR)/build/lib.* python setup.py nosetests
endif

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