python/setup.py: Drop version checking via pkg_resources
RFC PATCH 1/1 python/setup.py: Drop version checking via pkg_resources
From: Thomas Huth <[email protected]>
pkg_resources has been dropped from setuptools v82.0 and newer, so our setup.py script is currently failing there, breaking our CI. To fix it, switch to a direct version check instead. While we're at it, also bump the minimum version of setuptools to v44 now since that is the minimum that might still be in use on the distros we care about according to:
https://repology.org/project/python%3Asetuptools/versions
---
No clue whether that version check is fine with all versions of setuptools, thus I marked the patch as RFC. At least it survives the CI:
https://gitlab.com/thuth/qemu/-/pipelines/2319359396
python/setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
python/setup.py +2 -3
@@ -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,8 +29,8 @@ def main(): QEMU tooling installer """ - # https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108 - pkg_resources.require('setuptools>=39.2') + if int(setuptools.__version__.split('.')[0]) < 44: + raise ModuleNotFoundError('version of setuptools is too old') setuptools.setup(cmdclass={'bdist_egg': bdist_egg_guard})
Signature · 1 line
2.53.0
Quoted 11 lines · Thomas Huth
From: Thomas Huth <[email protected]>
pkg_resourceshas been dropped from setuptools v82.0 and newer, so oursetup.pyscript is currently failing there, breaking our CI. To fix it, switch to a direct version check instead. While we're at it, also bump the minimum version of setuptools to v44 now since that is the minimum that might still be in use on the distros we care about according to:
https://repology.org/project/python%3Asetuptools/versionsSigned-off-by Thomas Huth <[email protected]>
Quoted 8 lines
---
No clue whether that version check is fine with all versions of setuptools, thus I marked the patch as RFC. At least it survives the CI:
https://gitlab.com/thuth/qemu/-/pipelines/2319359396python/setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
This works so:
but the other option discussed on IRC was to remove the existing version check entirely on the basis that all our supported platforms will have sufficient version by default and we don't need to spend time checking for the benefit of unsupported platforms.
Quoted 28 lines
python/setup.py +2
-3@@ -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,8 +29,8 @@ def main(): QEMU tooling installer """ - # https://medium.com/@daveshawley/safely-using-setup-cfg-for-metadata-1babbe54c108 - pkg_resources.require('setuptools>=39.2') + if int(setuptools.__version__.split('.')[0]) < 44: + raise ModuleNotFoundError('version of setuptools is too old') setuptools.setup(cmdclass={'bdist_egg': bdist_egg_guard})Signature · 1 line
2.53.0
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|