#!/usr/bin/make -f

#export DH_VERBOSE = 1

BUILD_DATE  = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")

include /usr/share/openstack-pkg-tools/pkgos.make

export PYBUILD_NAME=vmware_nsxlib

# Skip the unit test suite during package build: the upstream tests are not
# compatible with the Python 3.12 runtime (unittest.assertDictContainsSubset
# has been removed in Python 3.12).
export DEB_BUILD_OPTIONS := $(DEB_BUILD_OPTIONS) nocheck

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

override_dh_clean:
	dh_clean -O--buildsystem=pybuild
	rm -rf .testrepository build __pycache__

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2 'vmware_nsxlib\.tests\.*'

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	pkgos-dh_auto_test --no-py2 'vmware_nsxlib\.tests\.*'
endif

override_dh_clean:
	dh_clean -O--buildsystem=pybuild
	rm -rf .testrepository build
