#!/usr/bin/make -f

export PYBUILD_NAME=requests_cache
export PYBUILD_DISABLE=test

LIB3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_purelib)")

%:
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
	# $(MAKE) -C docs html

#override_dh_auto_test:
#ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
#	# we can't use unittest discover -s tests as tests for redis/mongo are
#	# trying to use the system-installed redis/mongo instance, which is unsafe
#	sleep 10
#	PYTHONPATH=$$LIB2:tests python  -m unittest -v test_cache test_custom_dict test_dbdict test_monkey_patch test_thread_safety	
#	PYTHONPATH=$$LIB3:tests python3 -m unittest -v test_cache test_custom_dict test_dbdict test_monkey_patch test_thread_safety	
#endif

override_dh_installexamples:
	dh_installexamples -ppython-requests-cache-doc examples/*

override_dh_installdocs:
	#dh_installdocs -ppython-requests-cache-doc docs/_build/html
	dh_installdocs -A README.md

override_dh_installchangelogs:
	dh_installchangelogs -A HISTORY.md
