#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1


DESTDIR=$(CURDIR)/debian/python3-pypdf2/
PYPDF3DIR=$(CURDIR)/debian/python3-pypdf2/

export PYBUILD_NAME=pypdf2
export PYBUILD_DISABLE=2.7

PYTHON3=$(shell py3versions -vr)

override_dh_clean:
	dh_clean
	rm -rf $(CURDIR)/dist/ \
		$(CURDIR)/tests/pdf_cache/

build-python%:
	python$* -m build --wheel --no-isolation

override_dh_auto_build: $(PYTHON3:%=build-python%)
	dh_auto_build

install-python%:
	python$* -m installer --destdir=debian/python3-pypdf2/ dist/*.whl

override_dh_auto_install: $(PYTHON3:%=install-python%)
	dh_auto_install

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	pytest-3 tests --cov --cov-report term-missing -vv
endif

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

.PHONY: override_dh_auto_build override_dh_auto_install \
	override_dh_auto_test
