#!/usr/bin/make -f
#export DH_VERBOSE = 1
export PYBUILD_NAME=flask-bootstrap
%:
	dh $@ --with python3,sphinxdoc  --buildsystem=pybuild

export PYBUILD_TEST_ARGS=--ignore=tests/test_bootstrap4/test_render_form.py \
	--ignore=tests/test_bootstrap5/test_render_form.py \
	--ignore=tests/test_bootstrap4/test_bootstrap.py \
	--ignore=tests/test_bootstrap5/test_bootstrap5.py

# Build sphinx HTML documentation
override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. http_proxy='http://127.0.0.1:9/' python3 -m sphinx -N -bhtml docs/ debian/html

# Fixed font-in-non-font-package / font-outside-font-dir
override_dh_python3:
	dh_python3
	find debian/python3-flask-bootstrap/ -name 'bootstrap-icons.woff' \
		-exec ln -sfv /usr/share/fonts-font-awesome/fonts/fontawesome-webfont.woff {} \;
	find debian/python3-flask-bootstrap/ -name 'bootstrap-icons.woff2' \
		-exec ln -sfv /usr/share/fonts-font-awesome/fonts/fontawesome-webfont.woff2 {} \;

# Fixe privacy-breach-generic
override_dh_link:
	dh_link
	find debian/python3-flask-bootstrap/ -name '*.css' -exec sed -i 's|@import url("https://fonts.googleapis.com||g' {} \;
	find debian/python-flask-bootstrap-doc/ -name '*.html' -exec sed -i 's|src="https:||g' {} \;
