#1135722 DEB_BUILD_OPTIONS=terse (pybuild --quiet) broken on forky

#1135722#5
Date:
2026-05-05 08:02:09 UTC
From:
To:
AFAICT pybuild is broken on forky if you use DEB_BUILD_OPTIONS=terse.

This works on trixie but fails on forky (it builds twice, once with terse and once without, to prove terse is the problem):

    mmdebstrap trixie /dev/null --include=build-essential,debhelper,dh-python,flit,pybuild-plugin-pyproject,python3-all,python3-setuptools 'deb https://deb.debian.org/debian trixie main' 'deb-src https://deb.debian.org/debian trixie main' --customize-hook='set -x; chroot $1 apt-get build-dep python-idna; DEB_BUILD_OPTIONS=terse chroot $1 apt-get --build source python-idna; chroot $1 apt-get --build source python-idna'

    mmdebstrap forky /dev/null --include=build-essential,debhelper,dh-python,flit,pybuild-plugin-pyproject,python3-all,python3-setuptools 'deb https://deb.debian.org/debian forky main' 'deb-src https://deb.debian.org/debian forky main' --customize-hook='set -x; chroot $1 apt-get build-dep python-idna; DEB_BUILD_OPTIONS=terse chroot $1 apt-get --build source python-idna; chroot $1 apt-get --build source python-idna'

The problem is here:

     debian/rules binary
    dh binary --with python3 --buildsystem=pybuild
    I: pybuild plugin_pyproject:142: Building wheel for python3.14 with "build" module
    I: pybuild base:385: python3.14 -m build --skip-dependency-check --no-isolation --wheel --outdir /python-idna-3.11/.pybuild/cpython3_3.14_idna
    E: pybuild pybuild:485: build: plugin pyproject failed with:
    I: pybuild plugin_pyproject:142: Building wheel for python3.13 with "build" module
    I: pybuild base:385: python3.13 -m build --skip-dependency-check --no-isolation --wheel --outdir /python-idna-3.11/.pybuild/cpython3_3.13_idna
    E: pybuild pybuild:485: build: plugin pyproject failed with:
    dh_auto_build: error: pybuild --build -i python{version} -p "3.14 3.13" --quiet --parallel=4 returned exit code 13
    make: *** [debian/rules:6: binary] Error 13
    dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
    W: Download is performed unsandboxed as root as file 'python-idna_3.11-1.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
    E: Build command 'cd python-idna-3.11 && dpkg-buildpackage -b -uc' failed.

A full transcript is attached.

I encountered this with my own in-house package.
I picked python-idna at random as another flit-based package.
https://codesearch.debian.net/search?q=flit_core

#1135722#10
Date:
2026-05-06 02:05:47 UTC
From:
To:
Popping pybuild into a debugger and stepping through, the assertion in
the middle of this block fails:

/--- dhpython/tools.py:262 [execute()]

     with ExitStack() as stack:
         output: TextIO | int | None
         if log_output is False:
             output = None
         elif log_output is None:
             output = PIPE
         elif log_output:
             if isinstance(log_output, str):
                 log_output = stack.enter_context(
                     open(log_output, "a", encoding="utf-8")
                 )
             assert isinstance(log_output, TextIO)
             log_output.write(f"\n# command executed on
{datetime.now().isoformat()}")
             log_output.write(f"\n$ {command}\n")
             log_output.flush()
             output = log_output
---/ log_output is initially a str: (Pdb) p log_output '/build/python-idna-W7e44C/python-idna-3.11/.pybuild/cpython3_3.14/build_wheel_cmd.log' but its rebirth as a TextIO does not work as intended: > /usr/share/dh-python/dhpython/tools.py(291)execute() -> assert isinstance(log_output, TextIO) (Pdb) AssertionError > /usr/share/dh-python/dhpython/tools.py(291)execute() -> assert isinstance(log_output, TextIO) (Pdb) p log_output <_io.TextIOWrapper name='/build/python-idna-W7e44C/python-idna-3.11/.pybuild/cpython3_3.14/build_wheel_cmd.log' mode='a' encoding='utf-8'> it's actually a TextIOWrapper; changing the assertion to assert isinstance(log_output, io.TextIOBase) is enough to get it working. I guess this is a case where the typehint TextIO is not quite enough for the isinstance check. The failed assertion should probably generate some more useful noise too (perhaps raising a TypeError or ValueError if the log_output is neither the desired type nor coercible into a usable type? regards Stuart
#1135722#13
Date:
2026-05-24 22:06:54 UTC
From:
To:
Hello,

Bug #1135722 in dh-python reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/python-team/tools/dh-python/-/commit/1b4dab511830bf798aead0627256235305116db5
------------------------------------------------------------------------
Fix crash with DEB_BUILD_OPTIONS=terse

Closes: #1135722
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1135722

#1135722#20
Date:
2026-05-25 00:18:29 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
dh-python, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1135722@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stefano Rivera <stefanor@debian.org> (supplier of updated dh-python package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 24 May 2026 18:48:39 -0400
Source: dh-python
Architecture: source
Version: 7.20260524
Distribution: unstable
Urgency: medium
Maintainer: Piotr Ożarowski <piotr@debian.org>
Changed-By: Stefano Rivera <stefanor@debian.org>
Closes: 1133706 1135722 1137486
Changes:
 dh-python (7.20260524) unstable; urgency=medium
 .
   * Fix crash in "pybuild --interpreter python3.x" (Closes: #1137486)
   * Fix crash with DEB_BUILD_OPTIONS=terse (Closes: #1135722, LP: #2150227)
   * Don't require substvars with debhelper compat level >= 14 (Closes: #1133706)
Checksums-Sha1:
 123683de80fa2efa7c4479cdbe7deb5fc9e92c8a 1686 dh-python_7.20260524.dsc
 0f978266aa5b6bc15a0bdb2d54c3a53856f6fa5a 137884 dh-python_7.20260524.tar.xz
 a7733a4ae86fd3fcc420ef606a2b1f30f0f38126 6889 dh-python_7.20260524_source.buildinfo
Checksums-Sha256:
 b09fcef459f151deb1db348d9cf00160c46fcd2f2fa85c1567352c060e200f19 1686 dh-python_7.20260524.dsc
 800ce345f047a38d621ca75f56109ec1dea0c9521589d4d58615b0076b9fbeb1 137884 dh-python_7.20260524.tar.xz
 bafdb1497977c62d50bd4a714d59edbaa515f1d9d3d8ce016a19a9cdceca3b94 6889 dh-python_7.20260524_source.buildinfo
Files:
 3b210890c910dc7293de570c6e201bae 1686 python optional dh-python_7.20260524.dsc
 59ce232bcfe20d86b211f90a4d012cb0 137884 python optional dh-python_7.20260524.tar.xz
 9a562e8c2306a0643c8fde753c4729f1 6889 python optional dh-python_7.20260524_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iIoEARYKADIWIQTumtb5BSD6EfafSCRHew2wJjpU2AUCahORxxQcc3RlZmFub3JA
ZGViaWFuLm9yZwAKCRBHew2wJjpU2NHFAP98MFvfDrLjgCClx4HfhlgEBbQShOFa
GboohyzSkypCWQEAzlyMUxck9iU/yOop3L5y0Z/gnjcx48obpHVKhgQKsgI=
=3K3O
-----END PGP SIGNATURE-----