def initialise(): #pylint: disable=unused-variable import importlib, pkgutil from mrtrix3 import app, path initlist = [ ] base_parser = app.Parser(description='Base parser for construction of subparsers', parents=[app.cmdline]) subparsers = app.cmdline.add_subparsers(title='Algorithm choices', help='Select the algorithm to be used to complete the script operation; additional details and options become available once an algorithm is nominated. Options are: ' + ', '.join(getList()), dest='algorithm') for dummy_importer, package_name, dummy_ispkg in pkgutil.iter_modules( [ _algorithmsPath() ] ): module = importlib.import_module('mrtrix3.' + path.scriptSubDirName() + '.' + package_name) module.initialise(base_parser, subparsers) initlist.extend(package_name) app.debug('Initialised algorithms: ' + str(initlist))
def usage(cmdline): #pylint: disable=unused-variable from mrtrix3 import app, path #pylint: disable=import-outside-toplevel sys.path.insert(0, os.path.realpath(os.path.join(_algorithms_path(), os.pardir))) initlist = [ ] # Don't let Python 3 try to read incompatible .pyc files generated by Python 2 for no-longer-existent .py files pylist = get_list() base_parser = app.Parser(description='Base parser for construction of subparsers', parents=[cmdline]) subparsers = cmdline.add_subparsers(title='Algorithm choices', help='Select the algorithm to be used to complete the script operation; additional details and options become available once an algorithm is nominated. Options are: ' + ', '.join(get_list()), dest='algorithm') for dummy_importer, package_name, dummy_ispkg in pkgutil.iter_modules( [ _algorithms_path() ] ): if package_name in pylist: module = importlib.import_module(path.script_subdir_name() + '.' + package_name) module.usage(base_parser, subparsers) initlist.extend(package_name) app.debug('Initialised algorithms: ' + str(initlist))