From 13d6e1eb7c361f20706b709596496c16e0b5d1b1 Mon Sep 17 00:00:00 2001 From: William Woodall Date: Fri, 16 Jun 2023 14:37:12 -0700 Subject: [PATCH] cache lookup of importlib metadata in Node action (#365) * cache lookup of importlib metadata in Node action Signed-off-by: William Woodall * style fixup Signed-off-by: William Woodall --------- Signed-off-by: William Woodall --- launch_ros/launch_ros/actions/node.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/launch_ros/launch_ros/actions/node.py b/launch_ros/launch_ros/actions/node.py index cbd4e083..fd684ce2 100644 --- a/launch_ros/launch_ros/actions/node.py +++ b/launch_ros/launch_ros/actions/node.py @@ -559,9 +559,15 @@ def instantiate_extension( return extension_instance +g_entry_points_impl = None + + def get_extensions(logger): + global g_entry_points_impl group_name = 'launch_ros.node_action' - entry_points_impl = importlib_metadata.entry_points() + if g_entry_points_impl is None: + g_entry_points_impl = importlib_metadata.entry_points() + entry_points_impl = g_entry_points_impl if hasattr(entry_points_impl, 'select'): groups = entry_points_impl.select(group=group_name) else: