#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk # DEB_VERSION

export PYBUILD_TEST_ARGS= -v --full-trace -k 'not test_nftables_integration and not test_check_overlapping_addresses and not test_tun_listen and not test_click and not test_file_perms and not test_save_keys and not test_save_keys_create_dir and not test_save_keys_create_dir_decline and not test_static_keygen and not test_static_keygen_fail and not test_add_chain and not test_add_queue_rule and not test_add_table and not test_build and not test__get_cname and not test_dns_handle and not test_generate_prekeys and not test_get_addrs and not test_get_pk_hash and not test__resolve_keyserver_address and not test_get_ephemeral_key and not test_get_static_key and not test_handshake_cannot_replay and not test_keyserver and not test_click_invalid_directory and not test__generate_cookie and not test__is_in_subnet and not test__make_local_ipv4 and not test__process_cookie_from_queue and not test__process_handshake_from_queue and not test__pton and not test__queue_send_packet and not test__receive_from_queue and not test__send_from_queue and not test__update_incoming_pk_addrs and not test_add_peer and not test_get_ip_from_iface and not test_get_next_ip and not test_get_peer_by_pkh and not test_prune_connection and not test_queue_incoming and not test_remove_expired_peers and not test_remove_peer'

%:
	dh $@ --buildsystem=pybuild

B = $(CURDIR)/debian/tmp/usr/bin
M = $(CURDIR)/debian/tmp/usr/share/man/man1

execute_after_dh_auto_install:
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	mkdir -pv $(M)
	for p in "" "-keygen" "-server" "-dns-query"; do \
		env PYTHONPATH=$(CURDIR)/src \
		help2man --no-info --version-string="$(DEB_VERSION)" \
			-Idebian/pqconnect$$p.h2m $(B)/pqconnect$$p \
			-o $(M)/pqconnect$$p.1; \
	done
endif