Package: python3-d2to1
Version: 0.2.12-3

I have a third party, and somewhat legacy Python 3 software that depends on
python3-d2to1 to build properly.
However when building that software in bookworm got the following error,
from within python3-d2to1's code:

> ImportError: cannot import name '_get_unpatched' from 'setuptools.dist'

After some searching online I found out that RedHat has a similar bug
report in their BugZilla:

https://bugzilla.redhat.com/show_bug.cgi?id=2239998

Someone there linked to a pull request that fixes that issue. Since I know
my way around dpkg-dev, and quilt, I patched the package d2to1 locally with
the diff from the RedHat pull request:

Index: d2to1/d2to1/core.py
===================================================================
--- d2to1.orig/d2to1/core.py
+++ d2to1/d2to1/core.py
@@ -27,7 +27,10 @@ def d2to1(dist, attr, value):
     """

     from distutils.core import Distribution
-    from setuptools.dist import _get_unpatched
+    try:
+        from setuptools.dist import _get_unpatched
+    except ImportError:
+        from setuptools.dist import get_unpatched as _get_unpatched

     _Distribution = _get_unpatched(Distribution)

Which fixed my issue. I could now build and deploy my somewhat legacy
Python 3 third party software without problems.
This patch probably ought to go upstream though, as it is a problem with
d2to1 itself, and not with Debian's packaging of it. But until its
upstream, perhaps that patch wouldn't hurt.

Florian

Reply via email to