#!/usr/bin/make -f

export PYBUILD_NAME=chess-com-api

# Don't run these tests. They contact the live chess.com API.
export PYBUILD_TEST_ARGS= --ignore tests/test_client.py --ignore tests/test_integration.py --ignore chess_com_api/__init__.py

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
ifeq ($(filter nodoc,$(DEB_BUILD_OPTIONS)),)
	# Some of the documentation links to files that live in the project root
	# rather than under docs/. Copy them into docs/ (adjusting the filename
	# case where the links expect a different name) so that mkdocs can
	# resolve every internal link.
	cp contributing.md docs/CONTRIBUTING.md
	cp SECURITY.md docs/SECURITY.md
	mkdocs build -d $(CURDIR)/build/html -f $(CURDIR)/mkdocs.yml
endif

ifeq ($(filter nodoc,$(DEB_BUILD_OPTIONS)),)
override_dh_installdocs:
	dh_installdocs
	dh_mkdocs -T mkdocs -T libjs-underscore -T mkdocs-material
	find -type f -name "sitemap.xml.gz" -delete
endif
