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

#export DH_VERBOSE = 1

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

export PYBUILD_NAME=drf-yasg-nonfree
export PYBUILD_DISABLE=test
export PYBUILD_SYSTEM=pyproject

export DRF_YASG_UPSTREAM_VERSION=$(DEB_VERSION_UPSTREAM)

%:
	dh $@ --buildsystem=pybuild

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. python3 -m sphinx -b html -N docs/ $(CURDIR)/debian/python-drf-yasg-nonfree-doc/usr/share/doc/python-drf-yasg-nonfree-doc/html
	dh_sphinxdoc
endif

override_dh_auto_clean:
	rm -rf .mypy_cache docs/.build
	dh_auto_clean

override_dh_fixperms:
	dh_fixperms
	find debian/python3-drf-yasg-nonfree/usr/lib/python3/dist-packages/drf_yasg/static/drf-yasg/ -type f \
		\( -name "LICENSE" -o \
		   -name "README" \) \
		-exec rm {} \;
