#!/usr/bin/make -f

export PYBUILD_NAME=astor
export PYBUILD_TEST_PYTEST=1
export PYBUILD_TEST_ARGS_python3.6 = -k-test_convert_stdlib

# Get version from changelog as well as lsb_release
# to compute unique build version (useful for repo mirroring systems doing file pooling)
PKG_VERSION  := $(shell dpkg-parsechangelog | grep -E '^Version:' | cut -d' ' -f2)
DIST_NAME    := $(shell lsb_release -si)
DIST_RELEASE := $(shell lsb_release -sc)
DIST_VERSION := $(shell lsb_release -sr)
PKG_VERSION_TAG := $(PKG_VERSION)+$(DIST_NAME).$(DIST_RELEASE).$(DIST_VERSION)

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

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml        docs/ build/html # HTML generator
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bman        docs/ build/man # Manpage generator

override_dh_auto_clean:
	dh_auto_clean
	rm -rf .pytest_cache
	rm -rf tmp_rtrip

override_dh_gencontrol:
	dh_gencontrol -- -v"$(PKG_VERSION_TAG)"
