[Pkg-utopia-maintainers] Bug#942720: dh-python generates too tight dependencies for python3-dbus-tests

Simon McVittie smcv at debian.org
Mon Nov 18 13:34:19 GMT 2019


Control: reassign -1 dh-python 4.20191017

I'm reassigning this to (only) dh-python because been able to work around
it in dbus-python, but I think dh-python could probably make this easier.

Firstly, please note that this bug is only reproducible when there are
at least two supported versions of python3, currently 3.7 and 3.8.

On Sun, 20 Oct 2019 at 16:45:03 +0200, Matthias Klose wrote:
> Package: python3-dbus-tests,dh-python
> 
> seen when building the package with more than one supported Python3 version,
> the package has the uppder dependency: python3 (<< 3.8)
> 
> python3-dbus-tests_1.2.12-1build1_amd64.deb
..
>  Depends: dbus, python3-dbus, python3 (<< 3.8), python3 (>= 3.7~),
> python3.8, python3.8:any, python3:any, python3.7, python3.7:any, libc6 (>=
> 2.4), libpython3.7 (>= 3.7.0), libpython3.8 (>= 3.8.0~a1)

This is because python3-dbus-tests contains one private directory per
supported Python 3 version, with names like
/usr/lib/x86_64-linux-gnu/installed-tests/dbus-python/python3.7/test. They
are GNOME-style "installed tests", and are run by the autopkgtest.

The installed-tests directory for python3.X contains a bunch of executable
scripts (for which I want to use #!/usr/bin/python3.X), a native-code
extension dbus_py_test.so compiled for python3.X, and an executable
test-import-repeatedly which embeds the Python 3.X interpreter like
e.g. vim does (is linked to libpython3.X). The extension and embedder
were necessary to reproduce some historical dbus-python bugs that I
couldn't with pure Python.

dbus-python's debian/rules loops over all those private directories running
an appropriate dh_python3 --shebang for each one.

dh-python assumes that an unversioned extension in a private directory
is designed to be loaded by the default Python interpreter, so when it
sees dbus_py_test.so it generates a dependency on the default Python
interpreter: currently that's python3 (>= 3.7), (<< 3.8~).

I tried renaming each copy of dbus_py_test.so to
dbus_py_test.cpython-37m-x86_64-linux-gnu.so or similar (whatever is
appropriate for the corresponding python3.X version), but that makes
dh_python3 generate *contradictory* dependencies: at the time of writing
(during the migration from 3.7 to 3.8) it generates

    python3 (>= 3.7), python3 (<< 3.8~), python3 (>= 3.8), python3 (<< 3.9~)

which is impossible to satisfy. This gets simplified to

    python3 (<< 3.8~), python3 (>= 3.8)

in the actual package, but that's also impossible.

I also tried doing each dh_python3 with a different DEBPYTHON3_DEFAULT=3.X
to make it assume that /usr/lib/.../python3.X/test/dbus_py_test.so belongs
to python3.X, but that makes it generate the same contradictory
dependencies.

I was able to work around this by moving dbus_py_test.so into the public
Python directory /usr/lib/python3/dist-packages *and* renaming it to
dbus_py_test.cpython-37m-x86_64-linux-gnu.so or similar.

    smcv



More information about the Pkg-utopia-maintainers mailing list