#!/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)/build/

build-python%:
	python$* setup.py build

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

install-python%:
	python$* setup.py install --root=$(DESTDIR) --install-layout=deb

override_dh_auto_install: $(PYTHON3:%=install-python%)
	rm -rf $(DESTDIR)/usr/lib/python3/dist-packages/PyPDF2/__pycache__/
	dh_auto_install

override_dh_fixperms:
	chmod a-x $(PYPDF3DIR)/usr/share/doc/python3-pypdf2/examples/*
	dh_fixperms

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

.PHONY: override_dh_auto_build override_dh_auto_install override_dh_fixperms