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

export PYBUILD_NAME=scrapy
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
# some test_squeues.py tests are broken with recent python3-queuelib until the next python3-scrapy release
export PYBUILD_TEST_ARGS= \
	--ignore tests/test_command_check.py \
    -k 'not (test_squeues.py and (test_peek_fifo or test_peek_one_element or test_peek_lifo))'
export DH_ALWAYS_EXCLUDE=license.txt:_sources/:.buildinfo

%:
	dh $@ --with python3,bash_completion,sphinxdoc --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_install:
	dh_install -Xjquery.js

override_dh_clean:
	rm -rf docs/.build
	dh_clean

override_dh_compress:
	dh_compress -X.js -Xobjects.inv

override_dh_installchangelogs:
	dh_installchangelogs docs/news.rst
