#!/usr/bin/make -f

export PYBUILD_NAME=fake-factory
export DOC_PKG_NAME=faker-doc
SPHINXOPTS := -N

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_clean:
	rm -rf .mypy_cache

execute_before_dh_installman:
	PYTHONPATH="." help2man -n "command to generate fake data" --no-info \
		--output=debian/faker.1 debian/faker/usr/bin/faker

execute_after_dh_auto_install:
	# Move the python 3 script to the faker package
	mkdir -p debian/faker/usr/bin
	mv debian/python3-fake-factory/usr/bin/faker debian/faker/usr/bin/


execute_before_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$$(pybuild --print build_dir --interpreter python3 --name fake-factory) \
	python3 -m sphinx -b html $(SPHINXOPTS) docs $(CURDIR)/debian/$(DOC_PKG_NAME)/usr/share/doc/$(DOC_PKG_NAME)/html
endif
