Skip to content

Commit

Permalink
Better handle recipe provider inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Oct 26, 2023
1 parent 58fe00f commit 2718393
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Lib/gftools/builder/recipeproviders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ def get_provider(provider):
classes = [
(name, cls)
for name, cls in inspect.getmembers(mod, inspect.isclass)
if "RecipeProviderBase" not in name and issubclass(cls, RecipeProviderBase)
if "RecipeProviderBase" not in name
and issubclass(cls, RecipeProviderBase)
and provider in cls.__module__
]
return classes[-1][1]
if len(classes) > 1:
raise ValueError(
"Multiple recipe providers found in module %s: %s"
% (provider, [x[0] for x in classes])
)
return classes[0][1]

0 comments on commit 2718393

Please sign in to comment.