#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DH_ALWAYS_EXCLUDE=__pycache__

export DH_VERBOSE = 1
export PYBUILD_VERBOSE=1

export LANG=C.UTF-8
export LC_ALL=C.UTF-8

export PYBUILD_NAME=yotta
export PYBUILD_DESTDIR_python3=debian/$(PYBUILD_NAME)

export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/yotta/ --install-scripts=/usr/share/yotta/
export PYBUILD_TEST_ARGS=-v -v -k '    not TestCLIAccount \
                             and not TestCLI \
                             and not TestGitAccess \
                             and not TestGit \
                             and not TestGitHubAccess \
                             and not TestHGAccess \
                             and not TestHg \
                             and not TestValidation \
                             and not ComponentTestCase \
                             and not ConfigTest \
                             and not VersionTestCase \
                            '

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_clean:
	rm -rf docs/_site
	rm -rf *.egg-info/*

execute_after_dh_auto_build:
	# build custom manpage
	@echo DEB_VERSION_UPSTREAM $(DEB_VERSION_UPSTREAM)
	sed -e "s/__VERSION__/$(DEB_VERSION_UPSTREAM)/g" \
				< debian/yotta.1.md.in > debian/yotta.1.md
	pandoc debian/yotta.1.md -s -f markdown -t man -o debian/yotta.1
	# build documentation
	jekyll build --source ./docs --destination ./docs/_site/html --config ./docs/_config.yml --safe --drafts
