#!/usr/bin/make -f
#export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME=postgresql
export PYBUILD_TEST_ARGS=-k '\
	test_bytea_codec and \
	test_configfile \
	'

override_dh_auto_build:
	dh_auto_build
	# avoid shipping crypt.py since we rely on libpython3-stdlib instead
	rm -f debian/**/postgresql/resolved/crypt.py

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx \
		   -N -b html \
		   postgresql/documentation/sphinx/ \
		   $(CURDIR)/debian/python3-postgresql/usr/share/doc/python3-postgresql/html
	dh_sphinxdoc
endif

override_dh_auto_install:
	dh_auto_install
	rm -f $(CURDIR)/debian/python3-postgresql/usr/lib/**/dist-packages/postgresql/lib/libsys.sql

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