From 84764b4d0bd222fc9bd59e141ee2cdf6d9cbdf79 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 15 Aug 2024 14:52:04 +0100 Subject: [PATCH] Add exception for old versions of importlib_resources --- setuptools/_importlib.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setuptools/_importlib.py b/setuptools/_importlib.py index 5317be0fa0..0e803565b6 100644 --- a/setuptools/_importlib.py +++ b/setuptools/_importlib.py @@ -10,3 +10,10 @@ import importlib_resources as resources # pragma: no cover else: import importlib.resources as resources # noqa: F401 + + +if not hasattr(metadata, "EntryPoints"): # pragma: no cover + raise ImportError( + "`importlib-metadata` version is incompatible with `setuptools`. " + "Please install importlib-metadata>=4.6" # Equivalent to stdlib's in 3.10 + )