#! /usr/bin/make -f

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

export PYBUILD_NAME=locust
export SETUPTOOLS_SCM_PRETEND_VERSION=$(DEB_VERSION_UPSTREAM)

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

execute_before_dh_auto_build:
	# prebuilt web UI from the webui component tarball
	cp -a webui/locust/webui/dist locust/webui/
	python3 debian/remove-azure-ad.py locust/webui/dist/assets/src-*.js

override_dh_auto_test:
	# test_pytest_style_locustfile, test_request_name - need network access (the
	#   former also imports locust.test, which is not installed in the build dir)
	# test_default_wait_time - timing sensitive, flaky on loaded builders
	-http_proxy= https_proxy= PATH=$(PATH):$(CURDIR)/debian PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} {interpreter} -m pytest -v -k 'not test_pytest_style_locustfile and not test_request_name and not test_default_wait_time'" dh_auto_test

override_dh_installexamples:
	dh_installexamples -X.pyc

override_dh_clean:
	rm -rf locust/_version.py locust/webui/dist web_test_*.csv
	dh_clean
