git: 97d1d164cab3 - main - sysutils/py-salt: fix runtime conflict with py39-importlib-metadata

From: Brad Davis <brd_at_FreeBSD.org>
Date: Tue, 21 Mar 2023 15:06:19 UTC
The branch main has been updated by brd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=97d1d164cab342554bc413f269bab95752d3e704

commit 97d1d164cab342554bc413f269bab95752d3e704
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2023-03-21 15:02:58 +0000
Commit:     Brad Davis <brd@FreeBSD.org>
CommitDate: 2023-03-21 15:05:28 +0000

    sysutils/py-salt: fix runtime conflict with py39-importlib-metadata
    
    PR:             269858
    Approved by:    maintainer timeout
---
 sysutils/py-salt/Makefile                          |  1 +
 .../py-salt/files/patch-salt_utils_entrypoints.py  | 27 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/sysutils/py-salt/Makefile b/sysutils/py-salt/Makefile
index 5a29f0beb390..b32abac6a4de 100644
--- a/sysutils/py-salt/Makefile
+++ b/sysutils/py-salt/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	salt
 PORTVERSION=	3005.1
+PORTREVISION=	1
 CATEGORIES=	sysutils python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/sysutils/py-salt/files/patch-salt_utils_entrypoints.py b/sysutils/py-salt/files/patch-salt_utils_entrypoints.py
new file mode 100644
index 000000000000..6dcfa3725648
--- /dev/null
+++ b/sysutils/py-salt/files/patch-salt_utils_entrypoints.py
@@ -0,0 +1,27 @@
+--- salt/utils/entrypoints.py.orig	2022-09-26 21:22:01 UTC
++++ 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
+