#!/usr/bin/make -f

#export DH_VERBOSE = 1

export PYBUILD_NAME=python-ldap3-ad-auth

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_auto_configure:
	# So the tests can work
	mv $(CURDIR)/debian/impacket* $(CURDIR)/impacket

execute_after_dh_auto_install:
	mv $(CURDIR)/impacket $(CURDIR)/debian/python3-ldap3-ad-auth/usr/lib/python3*/dist-packages/ldap3_ad_auth/

override_dh_auto_test:
# https://lintian.debian.org/tags/override_dh_auto_test-does-not-check-DEB_BUILD_OPTIONS.html
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	python3 -m unittest discover -s tests
endif

execute_after_dh_fixperms:
	chmod -x $(CURDIR)/debian/python3-ldap3-ad-auth/usr/lib/python3*/dist-packages/ldap3_ad_auth/impacket/dcerpc/v5/dhcpm.py
	chmod -x $(CURDIR)/debian/python3-ldap3-ad-auth/usr/lib/python3*/dist-packages/ldap3_ad_auth/impacket/examples/ldap_shell.py
	chmod -x $(CURDIR)/debian/python3-ldap3-ad-auth/usr/lib/python3*/dist-packages/ldap3_ad_auth/impacket/examples/smbclient.py
