qemu/python/tests
John Snow 762c280d5f Python: add setuptools v60.0 workaround
Setuptools v60 and later include a bundled version of distutils, a
deprecated standard library scheduled for removal in future versions of
Python. Setuptools v60 is only possible to install for Python 3.7 and later.

Python has a distutils.sysconfig.get_python_lib() function that returns
'/usr/lib/pythonX.Y' on posix systems. RPM-based systems actually use
'/usr/lib64/pythonX.Y' instead, so Fedora patches stdlib distutils for
Python 3.7 and Python 3.8 to return the correct value.

Python 3.9 and later introduce a sys.platlibdir property, which returns
the correct value on RPM-based systems.

The change to a distutils package not provided by Fedora on Python 3.7
and 3.8 causes a regression in distutils.sysconfig.get_python_lib() that
ultimately causes false positives to be emitted by pylint, because it
can no longer find the system source libraries.

Many Python tools are fairly aggressive about updating setuptools
packages, and so even though this package is a fair bit newer than
Python 3.7/3.8, it's not entirely unreasonable for a given user to have
such a modern package with a fairly old Python interpreter.

Updates to Python 3.7 and Python 3.8 are being produced for Fedora which
will fix the problem on up-to-date systems. Until then, we can force the
loading of platform-provided distutils when running the pylint
test. This is the least-invasive yet most comprehensive fix.

References:
 https://github.com/pypa/setuptools/pull/2896
 https://github.com/PyCQA/pylint/issues/5704
 https://github.com/pypa/distutils/issues/110

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20220204221804.2047468-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2022-02-23 17:07:26 -05:00
..
flake8.sh python: only check qemu/ subdir with flake8 2021-06-30 21:54:04 -04:00
iotests-mypy.sh python: Add iotest linters to test suite 2021-11-01 11:54:59 -04:00
iotests-pylint.sh Python: add setuptools v60.0 workaround 2022-02-23 17:07:26 -05:00
isort.sh python: add avocado-framework and tests 2021-06-01 16:21:21 -04:00
mypy.sh python: add avocado-framework and tests 2021-06-01 16:21:21 -04:00
protocol.py python/aqmp: add LineProtocol tests 2021-09-27 12:10:29 -04:00
pylint.sh Python: add setuptools v60.0 workaround 2022-02-23 17:07:26 -05:00