#!/usr/bin/make -f

PYTHON2=$(shell pyversions -vr)

%:
	dh $@ --with python2,sphinxdoc

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=$(CURDIR) docs/id3_frames_gen.py > docs/api/id3_frames.rst
	$(MAKE) -C docs
	mv docs/_build docs/html
	$(MAKE) -C docs/man

override_dh_installchangelogs:
	dh_installchangelogs NEWS

test-python%:
	-
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	LC_ALL=C.UTF-8 python$* setup.py test
endif

override_dh_auto_test: $(PYTHON2:%=test-python%)

override_dh_clean:
	dh_clean
	rm -rf docs/html docs/man/_man
