#!/usr/bin/make -f

UPSTREAM_GIT ?= https://bitbucket.org/zzzeek/alembic.git
include /usr/share/openstack-pkg-tools/pkgos.make

%:
	dh $@ --buildsystem=python_distutils --with=python2,python3,sphinxdoc

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	sphinx-build -b html docs/build $(CURDIR)/debian/alembic/usr/share/doc/alembic/html
	dh_sphinxdoc
endif

override_dh_auto_install:
	pkgos-dh_auto_install

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	set -e ; for pyvers in 2.7 ${PYTHON3S}; do \
		python$$pyvers -m pytest ; \
	done
endif

help2man:
	help2man --version-string=$(VERSION) -n "lightweight database migration tool for usage with the SQLAlchemy" -N alembic > alembic.1
	sed -i "s/,\(\w\)/, \1/g" alembic.1

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3
