#!/usr/bin/make -f

export PYBUILD_NAME=absl
export PYBUILD_BEFORE_TEST=cp debian/WORKSPACE_file_copied_from_github {build_dir}/WORKSPACE
export PYBUILD_TEST_ARGS=|| true && cd {build_dir}; bazel test --python_path {version} --verbose_failures absl

# 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 --buildsystem=pybuild

# https://github.com/abseil/abseil-py/issues/40
override_dh_auto_test:

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