Skip to content
Snippets Groups Projects
Commit 13364682 authored by Manuel Günther's avatar Manuel Günther
Browse files

Fixed resource listing to sort resources by package; added option to print dummy tools

parent 9b6c3d8a
No related branches found
No related tags found
No related merge requests found
...@@ -13,27 +13,34 @@ def resources(): ...@@ -13,27 +13,34 @@ def resources():
default = ('d', 'p', 'e', 'a', 'g'), default = ('d', 'p', 'e', 'a', 'g'),
help = "Select the resource types that should be listed.") help = "Select the resource types that should be listed.")
parser.add_argument("--no-strip-dummy", '-s', action = 'store_true',
help = "If given, the dummy elements (usually used for testing purposes only) are **not** removed from the list.")
args = parser.parse_args() args = parser.parse_args()
kwargs = {}
if args.no_strip_dummy:
kwargs['strip'] = []
if 'd' in args.details or 'database' in args.details: if 'd' in args.details or 'database' in args.details:
print ("\nList of registered databases:") print ("\nList of registered databases:")
print (bob.bio.base.list_resources('database')) print (bob.bio.base.list_resources('database', **kwargs))
if 'p' in args.details or 'preprocessor' in args.details: if 'p' in args.details or 'preprocessor' in args.details:
print ("\nList of registered preprocessors:") print ("\nList of registered preprocessors:")
print (bob.bio.base.list_resources('preprocessor')) print (bob.bio.base.list_resources('preprocessor', **kwargs))
if 'e' in args.details or 'extractor' in args.details: if 'e' in args.details or 'extractor' in args.details:
print ("\nList of registered extractors:") print ("\nList of registered extractors:")
print (bob.bio.base.list_resources('extractor')) print (bob.bio.base.list_resources('extractor', **kwargs))
if 'a' in args.details or 'algorithm' in args.details: if 'a' in args.details or 'algorithm' in args.details:
print ("\nList of registered algorithms:") print ("\nList of registered algorithms:")
print (bob.bio.base.list_resources('algorithm')) print (bob.bio.base.list_resources('algorithm', **kwargs))
if 'g' in args.details or 'grid' in args.details: if 'g' in args.details or 'grid' in args.details:
print ("\nList of registered grid configurations:") print ("\nList of registered grid configurations:")
print (bob.bio.base.list_resources('grid')) print (bob.bio.base.list_resources('grid', **kwargs))
print() print()
......
...@@ -190,7 +190,7 @@ def list_resources(keyword, strip=['dummy']): ...@@ -190,7 +190,7 @@ def list_resources(keyword, strip=['dummy']):
retval = "" retval = ""
length = max(len(entry_point.name) for entry_point in entry_points) if entry_points else 1 length = max(len(entry_point.name) for entry_point in entry_points) if entry_points else 1
for entry_point in sorted(entry_points): for entry_point in sorted(entry_points, key=lambda p: p.dist.project_name):
if last_dist != str(entry_point.dist): if last_dist != str(entry_point.dist):
retval += "\n- %s: \n" % str(entry_point.dist) retval += "\n- %s: \n" % str(entry_point.dist)
last_dist = str(entry_point.dist) last_dist = str(entry_point.dist)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment