python: fix python-minreqs test failure et al
cover python: fix python-minreqs test failure et al
GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2320293005
The tox test is still broken because our use of avocado uses pkg_resources, it will have to be removed but in a separate series. Let's get the core tests green first and then worry about deeper surgeries later.
John Snow (2):
python: fix minreqs test under newest pip/setuptools
python: drop uses of pkg_resources
python/Makefile | 5 ++--- python/setup.py | 4 ---- python/tests/minreqs.txt | 10 +++++----- tests/Makefile.include | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/2 python: fix minreqs test under newest pip/setuptools
Even though we have been pinning versions for the minreqs test, the conflict arises because the isolated build environment that some versions of pip use by default will pull in the latest and greatest version.
Switch to using a non-isolated build mode and pin more of the packaging ecosystem to keep our Python 3.9 tests running happy on modern machines.
Note that we will be able to require Python >= 3.11 at the end of April when we drop support for Ubuntu 22.04 LTS.
--- python/Makefile | 5 ++--- python/tests/minreqs.txt | 10 +++++----- tests/Makefile.include | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-)
python/Makefile +2 -3
@@ -63,12 +63,11 @@ $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate: setup.cfg tests/minreqs.tx @( \ echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \ . $(QEMU_MINVENV_DIR)/bin/activate; \ - echo "INSTALL wheel $(QEMU_MINVENV_DIR)"; \ - $(PIP_INSTALL) wheel 1>/dev/null; \ echo "INSTALL -r tests/minreqs.txt $(QEMU_MINVENV_DIR)";\ $(PIP_INSTALL) -r tests/minreqs.txt 1>/dev/null; \ echo "INSTALL -e qemu $(QEMU_MINVENV_DIR)"; \ - PIP_CONFIG_SETTINGS="editable_mode=compat" $(PIP_INSTALL) -e . 1>/dev/null; \ + PIP_CONFIG_SETTINGS="editable_mode=compat" \ + $(PIP_INSTALL) --no-build-isolation -e . 1>/dev/null; \ ) @touch $(QEMU_MINVENV_DIR)
python/tests/minreqs.txt +5 -5
@@ -11,11 +11,12 @@ # When adding new dependencies, pin the very oldest non-yanked version # on PyPI that allows the test suite to pass. -# For some reason, the presence of packaging==14.0 below requires us to -# also pin setuptools to version 70 or below. Otherwise, the -# installation of the QEMU package itself fails, failing to find -# setuptools. +# Pin packaging utilities to older versions to prevent difficulties +# mixing and matching newer and older ecosystem packages. +packaging==14.0 setuptools<=70 +wheel<0.46 +pip<26 # Dependencies for qapidoc/qapi_domain et al sphinx==3.4.3
@@ -66,7 +67,6 @@ alabaster==0.7.1 babel==1.3 docutils==0.12 imagesize==0.5.0 -packaging==14.0 pytz==2011b0 requests==2.5.0 snowballstemmer==1.1
tests/Makefile.include +1 -1
@@ -106,7 +106,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ "VENVPIP","$1") $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml - $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/") + $(call quiet-venv-pip,install --no-build-isolation -e "$(SRC_PATH)/python/") $(MKVENV_ENSUREGROUP) $< testdeps $(call quiet-command, touch $@)
Signature · 1 line
2.53.0
PATCH 2/2 python: drop uses of pkg_resources
In reply to John Snowpkg_resources has been fully dropped from modern pip/setuptools distributions and we should phase out its use. This patch is enough to, by itself, repair most GitLab CI tests upstream; with the exception of tox tests which are still making use of avocado - which will be dropped in a separate series to restore functionality there.
--- python/setup.py | 4 ---- 1 file changed, 4 deletions(-)
python/setup.py +0 -4
@@ -7,7 +7,6 @@ import setuptools from setuptools.command import bdist_egg import sys -import pkg_resources class bdist_egg_guard(bdist_egg.bdist_egg):
@@ -30,9 +29,6 @@ def main(): QEMU tooling installer """ - # https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108 - pkg_resources.require('setuptools>=39.2') - setuptools.setup(cmdclass={'bdist_egg': bdist_egg_guard})
Signature · 1 line
2.53.0
Quoted 12 lines · John Snow
GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2320293005
The tox test is still broken because our use of avocado uses
pkg_resources, it will have to be removed but in a separate series. Let's get the core tests green first and then worry about deeper surgeries later.John Snow (2):
python: fix minreqs test under newest pip/setuptools
python: drop uses ofpkg_resources
Quoted 5 lines
python/Makefile | 5 ++--- python/setup.py | 4 ---- python/tests/minreqs.txt | 10 +++++----- tests/Makefile.include | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-)
Applying this series locally fixes the "No module named 'pkg_resources'" error, but instead I get:
lanath:noble:qemu$ make -C build/clang/ check-functional
make: Entering directory '/home/pm215/qemu/build/clang'
VENVPIP install --no-build-isolation -e /home/pm215/qemu/python/
error: subprocess-exited-with-error
× Preparing editable metadata (pyproject.toml) did not run successfully.
│ exit code: 1 ╰─> [13 lines of output]
running dist_info
creating /tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info writing /tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/PKG-INFO writing dependency_links to/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/dependency_links.txt
writing entry points to/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/entry_points.txt
writing requirements to/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/requires.txt
writing top-level names to/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/top_level.txt
writing manifest file
'/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/SOURCES.txt'
reading manifest file
'/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file
'/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/SOURCES.txt'
creating '/tmp/pip-modern-metadata-bj38p2z_/qemu-0.6.1.0a1.dist-info'
error: invalid command 'bdist_wheel'
[end of output]
note: This error originates from a subprocess, and is likely not a
problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
make: *** [/home/pm215/qemu/tests/Makefile.include:109:/home/pm215/qemu/build/clang/pyvenv/tests.group] Error 1
make: Leaving directory '/home/pm215/qemu/build/clang'
Applying only patch 2 and not patch 1 avoids this and allows check-functional to work.
thanks
-- PMM
Quoted 66 lines · Peter Maydell
Quoted 12 lines · John Snow
GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2320293005
The tox test is still broken because our use of avocado uses
pkg_resources, it will have to be removed but in a separate series. Let's get the core tests green first and then worry about deeper surgeries later.John Snow (2):
python: fix minreqs test under newest pip/setuptools
python: drop uses ofpkg_resourcesQuoted 5 lines
python/Makefile | 5 ++--- python/setup.py | 4 ---- python/tests/minreqs.txt | 10 +++++----- tests/Makefile.include | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-)Applying this series locally fixes the "No module named '
pkg_resources'" error, but instead I get:lanath:noble:qemu$ make -C build/clang/ check-functional
make: Entering directory '/home/pm215/qemu/build/clang'
VENVPIP install --no-build-isolation -e/home/pm215/qemu/python/
error: subprocess-exited-with-error× Preparing editable metadata (pyproject.toml) did not run successfully.
│ exit code: 1 ╰─> [13 lines of output]running
dist_info
creating/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-infowriting/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/PKG-INFOwritingdependency_linksto/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/dependency_links.txt
writing entry points to/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/entry_points.txt
writing requirements to/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/requires.txt
writing top-level names to/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/top_level.txt
writing manifest file
'/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/SOURCES.txt'
reading manifest file
'/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file
'/tmp/pip-modern-metadata-bj38p2z_/qemu.egg-info/SOURCES.txt'
creating '/tmp/pip-modern-metadata-bj38p2z_/qemu-0.6.1.0a1.dist-info'
error: invalid command 'bdist_wheel'
[end of output]note: This error originates from a subprocess, and is likely not a
problem with pip.
error: metadata-generation-failed× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
make: *** [/home/pm215/qemu/tests/Makefile.include:109:/home/pm215/qemu/build/clang/pyvenv/tests.group] Error 1
make: Leaving directory '/home/pm215/qemu/build/clang'
Quoted 5 lines
Applying only patch 2 and not patch 1 avoids this and allows check-functional to work.
thanks
-- PMM
Tch, I see what happened. Happened to not run into it in local testing because I have more packages than you!
Thanks, apologies for the fuss.
--js