#!/usr/bin/make -f

PYVERS   := $(shell pyversions -rv)
PY3VERS  := $(shell py3versions -rv)

include /usr/share/python/python.mk

%:
	dh $@ --with python2,python3,sphinxdoc

override_dh_auto_build:
	set -xe; \
	for py in $(PYVERS) $(PY3VERS); do \
		python$$py setup.py build; \
	done
	sphinx-build -aEN -b html -d build/doctrees doc/source build/html

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -xe; \
	for py in $(PYVERS); do \
		nosetests-$$py -w $(call py_builddir_sh,$$py); \
	done
endif

override_dh_auto_install:
	set -xe; \
	for py in $(PYVERS); do \
		python$$py setup.py install --skip-build --root debian/python-bs4 \
			--install-layout deb; \
	done
	set -xe; \
	for py in $(PY3VERS); do \
		python$$py setup.py install --skip-build --root debian/python3-bs4 \
			--install-layout deb; \
	done

override_dh_installchangelogs:
	dh_installchangelogs NEWS.txt

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build
