#!/usr/bin/make -f

export PYBUILD_NAME=aiomysql
export PYBUILD_TEST_PYTEST=1
export PYBUILD_TEST_ARGS=-v

export READTHEDOCS=True

%:
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	dh $@ --with python3,sphinxdoc --buildsystem=pybuild
else
	dh $@ --with python3 --buildsystem=pybuild
endif

override_dh_auto_clean:
	dh_auto_clean
	rm -rf .cache
	rm -rf .pytest_cache
	rm -f tests/fixtures/my.cnf
	rm -f docs/make.bat
	rm -f aiomysql-*/aiomysql/_scm_version.py

override_dh_auto_build:
	dh_auto_build
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/ build/html
endif

override_dh_auto_test:
ifneq ($(filter pkg.aiomysql.integrationtests,$(DEB_BUILD_PROFILES)),)
	dh_auto_test
endif
