Skip to content

Commit 6ff3d1b

Browse files
uriarielsebastinas
authored andcommitted
Support packages that are using the new importlib.metadata api (fix of
issue bpython#807)
1 parent db237d4 commit 6ff3d1b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,16 @@ def __init__(self, watcher, old_meta_path):
274274
self.watcher = watcher
275275
self.old_meta_path = old_meta_path
276276

277+
def find_distributions(self, context):
278+
for finder in self.old_meta_path:
279+
distribution_finder = getattr(finder, 'find_distributions', None)
280+
if distribution_finder is not None:
281+
loader = finder.find_distributions(context)
282+
if loader is not None:
283+
return loader
284+
285+
return None
286+
277287
def find_module(self, fullname, path=None):
278288
for finder in self.old_meta_path:
279289
loader = finder.find_module(fullname, path)

0 commit comments

Comments
 (0)