Skip to content
Snippets Groups Projects
Commit 2f954175 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME
Browse files

[utils] Function to get resources from entry point

parent 42108fc5
No related branches found
No related tags found
1 merge request!86Dump config file
Pipeline #
...@@ -586,3 +586,14 @@ def link_documentation(additional_packages = ['python', 'numpy'], requirements_f ...@@ -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)) print ("Path %s does not exist. The error was: %s" % (url, exc))
return mapping 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment