#!/usr/bin/make -f
#export DH_VERBOSE = 1
export PYBUILD_NAME=mkdocs_git_revision_date_localized_plugin
export PYBUILD_DESTDIR=debian/mkdocs-git-revision-date-localized-plugin

# Set git identity for tests that create temporary git commits,
# as the build environment (pbuilder/cowbuilder) has no git identity configured
export GIT_AUTHOR_NAME=Debian Tests
export GIT_AUTHOR_EMAIL=tests@debian
export GIT_COMMITTER_NAME=Debian Tests
export GIT_COMMITTER_EMAIL=tests@debian

# Skip timeago-related tests because upstream marks them as unnecessary
# for validating the JavaScript library in non-browser test environments.

# Skip tests: test_monorepo, test_build_material_theme, test_material_theme_locale,
# test_material_theme_no_locale and test_exclude_pages because
# they require a real Git repository during pybuild tests.
export PYBUILD_TEST_ARGS=-v -k "not techdocs and \
				not timeago and \
				not monorepo and \
				not test_build_material_theme and \
				not test_material_theme_locale and \
				not test_material_theme_no_locale and \
				not test_exclude_pages"

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	mkdocs build -d $(CURDIR)/html -f $(CURDIR)/mkdocs.yml
	rm -f $(CURDIR)/html/requirements.* $(CURDIR)/html/sitemap.xml.gz
endif

override_dh_mkdocs:
	dh_mkdocs --theme-package mkdocs-material
