On 12.08.2025 00:59, Paolo Bonzini wrote:
Il lun 11 ago 2025, 21:02 John Snow <js...@redhat.com
<mailto:js...@redhat.com>> ha scritto:
From: "Sv. Lockal" <lockals...@gmail.com <mailto:lockals...@gmail.com>>
Fix compilation with pip-25.2 due to missing distlib.version
Stupid question: can we just say that, starting with 10.1, people have
to install distlib to build QEMU?
There's nothing changed in this regard on the qemu side, - distlib has
always been required. The change is on the python side, not on qemu.
The same fix is needed for all previous qemu releases. Or to install
distlib.
We're bending over backwards just because the Python developers on one
hand keep shipping pip while saying that "no, pip is absolutely not
special"; and on the other hand keep *not* shipping packaging and
distlib while complaining that people don't use them.
This is a bit backwards, it looks like, and a bit too gross.
First, pip vendors a few crate^Wlibs for internal use, but these libs
had never been public, - that's why distlib is imported from
pip._vendor. We used this hack in qemu to simplify bootstrap, but
it was never the intended usage in pip, and hence there's no backwards
compatibility break here from the pip side.
Second, which is a continuation of the first, strictly speaking it
is our fault that we use distlib without depending on it.
And 3rd, it seems like Current Way (tm) is to use "packaging" library
instead of distlib. And packaging library is shipped within pip for
a decade or so already - the same way as distlib. This is why I
wrote "backwards" above - by requiring distlib, we seems to work
backwards, because current python way - which's been this way for
years - is to use packaging, not distlib. But I'm not someone
involved in python, - I don't even know python language enough to
write a minimal hello,world! program :) -- so I might be
misunderstanding something here.
In debian, I just added a build dependency on distlib for qemu -
in addition to venv, so it's definitely not a big deal.
But ok. To sum it up:
right now, with introduction of pip 25.2, qemu can't be built anymore
without installing additional deps. So far, qemu had worked around
missing python deps automatically, shipping everyhing it needs (except
of the python itself) in the source tarball. We can continue to try
to be friendly to the target environment and require nothing, - if we
do, we have to adjust.
If we require some python library to be present, we as well can just
list everything we need and stop jumping through hoops entirely in
mkvenv.py (and elsewhere), and just use things directly, assuming
they're installed. This simplifies our bootstrap, - but I don't
think this is actually necessary, bootstrap is not the most complicated
thing in qemu.
And whenever to embed/require distlib or to switch to packaging is an
orthogonal question, - it looks like "packaging" is the way to go now,
with switching other distlib usage(s) to it. But I'm definitely not
the one to judge here.
Either way, we're at rc3 now, and have to do some quick fix, - this fix
(or similar one which prefers packaging over distlib) seems to be the
best quick solution.
Thanks,
/mjt