#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.
#export DH_VERBOSE = 1

export PYBUILD_NAME=elastic-transport
# remove otel tests, missing opentelemetry-jdk in debian
# and ignore tests with inet access.
export PYBUILD_TEST_ARGS=\
 --ignore=tests/test_otel.py \
 -k 'not test_async_transport_httpbin \
 and not test_httpbin \
 and not test_simple_request \
 and not test_node \
 and not test_ssl_assert_fingerprint \
 and not test_assert_fingerprint_in_cert_chain \
 and not test_default_headers \
 and not test_custom_headers \
 and not test_custom_user_agent \
 and not test_head \
 and not test_debug_logging \
 and not test_debug_logging_uncompressed_body \
 and not test_debug_logging_no_body \
 and not test_debug_logging_error \
 and not test_supported_tls_versions \
 and not test_unsupported_tls_versions \
 and not test_ca_certs_with_verify_ssl_false_raises_error \
 and not test_uncompressed_body_logged \
 and not test_failed_request_logs \
 and not test_threading_test \
 '
export PYBUILD_AFTER_INSTALL= rm -fr {destdir}/usr/lib/python3*/dist-packages/elastic_transport-*/top_level.txt

BUILD_DATE  = $(shell LC_ALL=C date -u "+%d %B %Y" -d "@$(SOURCE_DATE_EPOCH)")
SPHINXOPTS := -N -D html_last_updated_fmt="$(BUILD_DATE)"

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build:
	PYTHONPATH=. sphinx-build $(SPHINXOPTS) -b html docs/sphinx build/html
