File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 11import contextlib
22import logging
3+ from importlib .metadata import EntryPoints , entry_points
34from pathlib import Path
45from typing import Iterator , List
56
6- from pip ._vendor .pygments .plugin import iter_entry_points
7-
87from pip ._internal .models .plugin import DistInspectorPlugin , Plugin , plugin_from_module
98
109logger = logging .getLogger (__name__ )
1110
1211_loaded_plugins : List [Plugin ] = []
12+
13+
14+ def iter_entry_points (group_name : str ) -> EntryPoints :
15+ groups = entry_points ()
16+ if hasattr (groups , "select" ):
17+ # New interface in Python 3.10 and newer versions of the
18+ # importlib_metadata backport.
19+ return groups .select (group = group_name )
20+ else :
21+ assert hasattr (groups , "get" )
22+ # Older interface, deprecated in Python 3.10 and recent
23+ # importlib_metadata, but we need it in Python 3.8 and 3.9.
24+ return groups .get (group_name , [])
25+
26+
1327for entrypoint in iter_entry_points (group_name = "pip.plugins" ):
1428 try :
1529 module = entrypoint .load ()
You can’t perform that action at this time.
0 commit comments