Skip to content
Snippets Groups Projects
Commit 35d904f1 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

fsl/__init__ uses pkgutil to find fslpy tools, instead of 'glob fsl/tools/*py'

parent 8ff5a279
No related branches found
No related tags found
No related merge requests found
...@@ -52,12 +52,11 @@ also provide the following module level attributes: ...@@ -52,12 +52,11 @@ also provide the following module level attributes:
import logging import logging
import pkgutil
import warnings import warnings
import os import os
import os.path as op
import sys import sys
import glob
import argparse import argparse
import importlib import importlib
import subprocess import subprocess
...@@ -109,15 +108,7 @@ def getFSLToolNames(): ...@@ -109,15 +108,7 @@ def getFSLToolNames():
"""Returns the name of every tool in the :mod:`fsl.tools` package. """Returns the name of every tool in the :mod:`fsl.tools` package.
""" """
toolFiles = glob.glob(op.join(op.dirname(tools.__file__), '*py')) allTools = [mod for _, mod, _ in pkgutil.iter_modules(tools.__path__)]
allTools = []
for toolFile in toolFiles:
toolName = op.splitext(op.basename(toolFile))[0]
if toolName != '__init__':
allTools.append(toolName)
return allTools return allTools
......
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