#!/usr/bin/make -f

export PYBUILD_NAME=flask-peewee
%:
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. python3 -m sphinx -N -bhtml docs/ docs/build/html # HTML generator
	PYTHONPATH=. python3 -m sphinx -N -bman docs/ docs/build/man # Manpage generator

override_dh_auto_test:
	# The tarball doesn't contain runtest.py.

override_dh_auto_install:
	dh_auto_install
	# We don't install examples in dist-packages
	rm -r $(CURDIR)/debian/python3-flask-peewee/usr/lib/*/dist-packages/example

override_dh_link:
	dh_link
	# Use Debian-packaged jquery and and underscore
	rm $(CURDIR)/debian/python3-flask-peewee/usr/lib/python3/dist-packages/flask_peewee/static/js/jquery.min.js
	dh_link -ppython3-flask-peewee usr/share/javascript/jquery/jquery.min.js usr/lib/python3/dist-packages/flask_peewee/static/js/jquery.min.js
	rm $(CURDIR)/debian/python-flask-peewee-doc/usr/share/doc/python-flask-peewee-doc/html/_static/jquery.js
	dh_link -ppython-flask-peewee-doc usr/share/javascript/jquery/jquery.min.js usr/share/doc/python-flask-peewee-doc/html/_static/jquery.js
	rm $(CURDIR)/debian/python-flask-peewee-doc/usr/share/doc/python-flask-peewee-doc/html/_static/underscore.js
	dh_link -ppython-flask-peewee-doc /usr/share/javascript/underscore/underscore.min.js usr/share/doc/python-flask-peewee-doc/html/_static/underscore.js
