From c673f3d0fe87f6e23a259c620fba7fc9e9d3621f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 19 May 2023 10:06:19 +0200 Subject: mkvenv: replace distlib.database with importlib.metadata/pkg_resources importlib.metadata is just as good as distlib.database and a bit more battle-proven for "egg" based distributions, and in fact that is exactly why mkvenv.py is not using distlib.database to find entry points: it simply does not work for eggs. The only disadvantage of importlib.metadata is that it is not available by default before Python 3.8, so we need a fallback to pkg_resources (again, just like for the case of finding entry points). Do so to fix issues where incorrect egg metadata results in a JSONDecodeError. While at it, reuse the new _get_version function to diagnose an incorrect version of the package even if importlib.metadata is not available. Signed-off-by: Paolo Bonzini --- python/setup.cfg | 6 ------ 1 file changed, 6 deletions(-) (limited to 'python/setup.cfg') diff --git a/python/setup.cfg b/python/setup.cfg index 5abb7d30ad..42f0b0be07 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -115,9 +115,6 @@ ignore_missing_imports = True [mypy-distlib] ignore_missing_imports = True -[mypy-distlib.database] -ignore_missing_imports = True - [mypy-distlib.scripts] ignore_missing_imports = True @@ -127,9 +124,6 @@ ignore_missing_imports = True [mypy-pip._vendor.distlib] ignore_missing_imports = True -[mypy-pip._vendor.distlib.database] -ignore_missing_imports = True - [mypy-pip._vendor.distlib.scripts] ignore_missing_imports = True -- cgit 1.4.1