From 2f9541755c179508b4468a54183c3241366290c5 Mon Sep 17 00:00:00 2001
From: Theophile GENTILHOMME <tgentilhomme@jurasix08.idiap.ch>
Date: Fri, 6 Jul 2018 15:13:17 +0200
Subject: [PATCH] [utils] Function to get resources from entry point

---
 bob/extension/utils.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/bob/extension/utils.py b/bob/extension/utils.py
index 0af64e7..f8cf103 100644
--- a/bob/extension/utils.py
+++ b/bob/extension/utils.py
@@ -586,3 +586,14 @@ def link_documentation(additional_packages = ['python', 'numpy'], requirements_f
         print ("Path %s does not exist. The error was: %s" % (url, exc))
 
   return mapping
+
+
+def resource_keys(entry_point_group, exclude_packages=[], strip=['dummy']):
+  """Reads and returns all resources that are registered with the given
+  entry_point_group.
+  Entry points from the given ``exclude_packages`` are ignored."""
+  ret_list = [entry_point.name for entry_point in
+              pkg_resources.iter_entry_points(entry_point_group) 
+              if (entry_point.dist.project_name not in exclude_packages and
+                  not entry_point.name.startswith(tuple(strip)))]
+  return sorted(ret_list)
-- 
GitLab