#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk

# pdm-backend builds itself with its in-tree backend, which reads the version
# from git.  Pass the upstream version instead (2.5.0+ds1 -> 2.5.0,
# 2.6.0~a1+ds1 -> 2.6.0a1).  Only set it for the build step: when set during
# the tests, it overrides the version of the test projects that use scm.
PDM_VERSION = $(subst ~,,$(DEB_VERSION_UPSTREAM:%+ds1=%))

# The scm tests create git commits; give git an identity.
export GIT_AUTHOR_NAME = Debian Build
export GIT_AUTHOR_EMAIL = build@example.invalid
export GIT_COMMITTER_NAME = $(GIT_AUTHOR_NAME)
export GIT_COMMITTER_EMAIL = $(GIT_AUTHOR_EMAIL)

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	PDM_BUILD_SCM_VERSION=$(PDM_VERSION) dh_auto_build
