#!/usr/bin/make -f

UPSTREAM_GIT := https://github.com/powervm/pypowervm.git
include /usr/share/openstack-pkg-tools/pkgos.make

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

override_dh_auto_clean:
	rm -rf build

override_dh_auto_build:
	echo "Do nothing..."

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2

	set -e ; set -x ; for lc in $$(ls -d pypowervm/locale/*/ | cut -f3 -d'/'); do \
		mkdir -p debian/python3-pypowervm/usr/share/locale/$$lc/LC_MESSAGES ; \
		msgfmt -o debian/python3-pypowervm/usr/share/locale/$$lc/LC_MESSAGES/pypowervm.mo pypowervm/locale/$$lc/pypowervm.po ; \
	done

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	# See https://bugs.launchpad.net/pypowervm/+bug/1856354
	pkgos-dh_auto_test --no-py2 'pypowervm\.tests\.((?!.*test_session\.TestSession\.test_session_clone.*|.*tasks\.test_vterm\.TestVterm\.test_open_vnc_vterm_nonascii.*|.*test_vterm\.TestVterm\.test_open_vnc_vterm_nonvnc_noforce.*))'
endif
