#!/usr/bin/make -f

export PYBUILD_NAME=semantic-release
export PYBUILD_TEST_PYTEST=1
export PYBUILD_TEST_ARGS=-x -k "not test_vcs_helpers.py and not test_current_release_version_should_return_correct_version and not test_cli and not test_config and not test_current_version_should_return_correct_version"

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build $@ --buildsystem=pybuild
	cd docs; PYTHONPATH=.. make man; PYTHONPATH=.. LC_ALL=C.UTF-8 LANGUAGE=C.UTF-8 sphinx-build -bhtml . _build/html

override_dh_auto_clean:
	dh_auto_clean
	rm -rf docs/api/ docs/_build/ python_semantic_release.egg-info/

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	$(eval BUILD_DIR=$(shell pybuild --print '{build_dir}'))
	for dir in $(BUILD_DIR); do \
		cp -r tests $$dir ; \
	done
	dh_auto_test
	for dir in $(BUILD_DIR); do \
		rm -r $$dir/tests ; \
	done
endif
