#!/usr/bin/make -f
# -*- makefile -*-

export PYBUILD_NAME=scrapy
# needed because of tox in B-D
export PYBUILD_TEST_PYTEST=1
export PYBUILD_BEFORE_TEST=cd {dir}/tests/keys; cat example-com.key.pem example-com.cert.pem >cert.pem
# test_command_check.py requires network access: https://github.com/scrapy/scrapy/issues/5409
# test_start_requests_laziness is especially flaky: https://github.com/scrapy/scrapy/issues/5957
# test_utf16 is broken on big-endian: https://github.com/scrapy/scrapy/issues/5954
export PYBUILD_TEST_ARGS= \
	--ignore tests/test_command_check.py \
	-k 'not (test_start_requests_laziness or test_utf16)'
export DH_ALWAYS_EXCLUDE=license.txt:_sources/:.buildinfo

%:
	dh $@ --buildsystem=pybuild

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. python3 -m sphinx -b html -N docs/ $(CURDIR)/debian/python-scrapy-doc/usr/share/doc/python-scrapy-doc/html
	dh_sphinxdoc
endif

override_dh_installchangelogs:
	dh_installchangelogs docs/news.rst
