-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgpkg: salt 3005.1-2: new patch for importlib issues
- Loading branch information
Showing
3 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/salt/utils/entrypoints.py b/salt/utils/entrypoints.py | ||
index 3effa0b494..9452878ade 100644 | ||
--- a/salt/utils/entrypoints.py | ||
+++ b/salt/utils/entrypoints.py | ||
@@ -38,13 +38,20 @@ def iter_entry_points(group, name=None): | ||
entry_points_listing = [] | ||
entry_points = importlib_metadata.entry_points() | ||
|
||
- for entry_point_group, entry_points_list in entry_points.items(): | ||
- if entry_point_group != group: | ||
- continue | ||
- for entry_point in entry_points_list: | ||
+ try: | ||
+ for entry_point in entry_points.select(group=group): | ||
if name is not None and entry_point.name != name: | ||
continue | ||
entry_points_listing.append(entry_point) | ||
+ except AttributeError: | ||
+ # importlib-metadata<5.0.0 | ||
+ for entry_point_group, entry_points_list in entry_points.items(): | ||
+ if entry_point_group != group: | ||
+ continue | ||
+ for entry_point in entry_points_list: | ||
+ if name is not None and entry_point.name != name: | ||
+ continue | ||
+ entry_points_listing.append(entry_point) | ||
|
||
return entry_points_listing | ||
|