summaryrefslogtreecommitdiff
path: root/upstream-layers/openembedded-core/meta/recipes-devtools/python/python3/0001-prefer-valid-entrypoints.patch
blob: 1250dc9ff044d5c4209e10fa653be38d34cd978e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From ef33ac27e3ac1b9cb159d7eec0ad1af120cd9dc1 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@arm.com>
Date: Fri, 17 Apr 2026 16:53:42 +0100
Subject: [PATCH] prefer valid entrypoints

When there are multiple distributions found and some of them are invalid, ensure that
the entry_points() accessor puts valid dists first.

Upstream-Status: Submitted [https://github.com/python/importlib_metadata/issues/534]
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 Lib/importlib/metadata/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Lib/importlib/metadata/__init__.py b/Lib/importlib/metadata/__init__.py
index 085378c..ff5cae4 100644
--- a/Lib/importlib/metadata/__init__.py
+++ b/Lib/importlib/metadata/__init__.py
@@ -1016,7 +1016,7 @@ def entry_points(**params) -> EntryPoints:
     :return: EntryPoints for all installed packages.
     """
     eps = itertools.chain.from_iterable(
-        dist.entry_points for dist in _unique(distributions())
+        dist.entry_points for dist in _unique(Distribution._prefer_valid(distributions()))
     )
     return EntryPoints(eps).select(**params)