Package: dh-python
Version: 6.20250414
Severity: normal
File: /usr/share/perl5/Debian/Debhelper/Buildsystem/pybuild.pm

Hi!

I have been having trouble building backports of a package with
setuptools-scm as a build-dep.

lavamind eventually figured a hack out of this, which you can see
here:

https://gitlab.com/anarcat/asncounter/-/commit/5a5cbb3c5c78152af791da09c0230ec6818d16d0

which is essentially to add this to the debian/rules file:

export SETUPTOOLS_SCM_PRETEND_VERSION=$(shell dpkg-parsechangelog -SVersion | 
sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~git.*//' -e 's/~bpo.*//' -e 
's/~/.0/' -e 's/+dfsg1//' -e 's/+ds1//' | head -n 1)

... to override the "pretend" version.

Before that, the build would fail with:

packaging.version.InvalidVersion: Invalid version: '0.7.0-bpo13+1'

And, indeed, that is an invalid package version in Python:

>>> from packaging import version
>>> version.Version("0.7.0-bpo13+1")
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    version.Version("0.7.0-bpo13+1")
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/packaging/version.py", line 202, in 
__init__
    raise InvalidVersion(f"Invalid version: {version!r}")
packaging.version.InvalidVersion: Invalid version: '0.7.0-bpo13+1'

Normal Debian versions with dashes are okay, that said:

>>> version.Version("0.7.0-1")
<Version('0.7.0.post1')>

I'm not sure what should be done to fix this. wRAR on #debian-python
suggested I file this bug report, but also that the `+` could be
replaced with a dash, but that doesn't work either:

packaging.version.InvalidVersion: Invalid version: '0.7.0-bpo13-1'

We *could* replace "bpo" with "pre" which would work and would even
mean something somewhat similar:

>>> version.Version("0.7.0-pre13-1")
<Version('0.7.0rc13.post1')>
>>> version.Version("0.7.0-pre13-1") < version.Version("0.7.0-1")
True

But really, as far as Python is concerned, I would just strip out any
debian specific stuff and stay with the upstream version, in this case
`0.7.0`.

The full build log is available at:

https://paste.lib3.net/lavamind/2026-09-29-xhBAI9DJyb8DNU2IHfJTDJLAQhw3qk9qzYWn5387UVg/stdin.txt

And can be reproduced by trying to backport the 0.7.0-1 asncounter
package without change.

-- System Information:
Debian Release: 13.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'stable-debug'), (500, 'stable'), (1, 'experimental'), (1, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.111+deb13-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dh-python depends on:
ii  python3  3.13.5-1

dh-python recommends no packages.

Versions of packages dh-python suggests:
ii  dpkg-dev           1.22.22
pn  flit               <none>
ii  libdpkg-perl       1.22.22
ii  python3-build      1.2.2-2
ii  python3-installer  0.7.0+dfsg1-3
ii  python3-wheel      0.46.1-2

-- no debconf information

Reply via email to