Package: dh-python
Severity: wishlist
Version: 5.20220403
X-Debbugs-CC: pi...@debian.org stefa...@debian.org c.schoen...@t-online.de

Dear dh-python maintainers,

First of all, thanks for the hard work in developing dh-python and pybuild.
When integrating pybuild into pyproject-based packaging that uses pdm-pep517
as build backend, I found some need that pybuild does not seem to satisfy.

If I understand correctly, it seems that pybuild will strip all unknown
environment variables before invoking the actual build commands. For example,
with following debian/rules snippet:

============================================

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

export PYBUILD_NAME=autorefs
export PYBUILD_SYSTEM=pyproject
export PDM_PEP517_VERSION = $(DEB_VERSION_UPSTREAM)

%:
        dh $@ --buildsystem=pybuild


============================================

During package building, the "PDM_PEP517_VERSION" variable will not appear in
the environment variable list when invoking "pythonX.Y -m build". This makes
python3-pdm-pep517 confused when the package version cannot be recognized [1]
using scm tags during Debian packaging. An example would be [2], where the
version string ends up as 0.0.0.

As a result, I am wondering if we could set up some mechanism to pass
packager-specified environment variables to the actual build program. It could
be something like this:

============================================

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

export PYBUILD_NAME=autorefs
export PYBUILD_SYSTEM=pyproject
export PYBUILD_ENVVAR_PDM_PEP517_VERSION = $(DEB_VERSION_UPSTREAM)

%:
        dh $@ --buildsystem=pybuild


============================================

...and eventually "pythonX.Y -m build" invocation will read
"PDM_PEP517_VERSION = x.y.z" in its environment variable list.

Please let me know whether this design is reasonable, or if you have some
better solution in solving the issue of [2]. I know that adding package-
specific patches could be a solution, but allowing packager to explicitly pass
package version through environment variable could be more elegant.


Thanks,
Boyuan Yang


[1] https://github.com/pdm-project/pdm-pep517#dynamic-project-version
[2]
https://salsa.debian.org/python-team/packages/mkdocs-autorefs/-/tree/bc79abd711f2cfe627d2d9c852379d7b571b4aa9

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to