Commit 894153c0 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Call them "modules", not "plugins"

parent 74dd216a
......@@ -166,7 +166,7 @@ class Manifest(dict):
destination = expand(destination)
if name in self:
log.warning('Plugin with name %s [%s] already exists! Overwriting '
log.warning('Module with name %s [%s] already exists! Overwriting '
'with [%s]', name, self[name].url, url)
self[name] = Plugin(name,
......@@ -240,7 +240,7 @@ def downloadManifest(url : Union[str, pathlib.Path]) -> Manifest:
destination=plugin.get('destination'))
except KeyError as e:
raise ManifestInvalid(f'The manifest file {url} '
'contains an invaluid plugin '
'contains an invaluid module '
'definition: {plugin}') from e
return manifest
......@@ -57,7 +57,7 @@ def createArchiveDir(archiveDir : Union[str, pathlib.Path]):
:arg archiveDir: Path to archive directory
"""
info(f'Downloaded plugin files will be cached in {archiveDir}')
info(f'Downloaded module files will be cached in {archiveDir}')
try:
os.makedirs(archiveDir, exist_ok=True)
except Exception as e:
......@@ -75,7 +75,7 @@ def _selectOnePlugin(pluginName : str) -> List[str]:
the user selected the plugin.
"""
question(f'Do you want to download the [{pluginName}] plugin?', EMPHASIS)
question(f'Do you want to download the [{pluginName}] module?', EMPHASIS)
info('Press enter or type Y to confirm the installation. Any other '
'response will cancel the download.', indent=2, wrap=True)
......@@ -97,13 +97,13 @@ def _selectMultiplePlugins(pluginNames : List[str]) -> List[str]:
while True:
info('Type "all" to download all of the plugins that are listed. '
'Alternately, enter the numbers of each plugin you would like '
info('Type "all" to download all of the modules that are listed. '
'Alternately, enter the numbers of each module you would like '
'to download, separated by spaces. For example, if you would '
f'like to download the [{pluginNames[0]}] and [{pluginNames[1]}] '
'plugins, enter "1 2".', indent=2, wrap=True)
'modules, enter "1 2".', indent=2, wrap=True)
plugins = prompt('Enter plugin(s) to download: ')
plugins = prompt('Enter module(s) to download: ')
if plugins.lower() == 'all':
plugins = pluginNames
......@@ -112,14 +112,14 @@ def _selectMultiplePlugins(pluginNames : List[str]) -> List[str]:
try:
plugins = [int(t) for t in plugins.split()]
except Exception:
error(f'Specified plugin(s) {plugins} not understood')
error(f'Specified module(s) {plugins} not understood')
continue
if len(plugins) == 0:
warning('No plugins specified! Type "all" to '
'download all plugins.', wrap=True)
warning('No modules specified! Type "all" to '
'download all modules.', wrap=True)
continue
if any([p <= 0 or p > len(pluginNames) for p in plugins]):
error(f'One of the requested plugins [{plugins}] does not exist')
error(f'One of the requested modules [{plugins}] does not exist')
continue
plugins = [pluginNames[p - 1] for p in plugins]
......@@ -147,12 +147,12 @@ def selectPlugins(manifest : Manifest, category : str = None) -> List[Plugin]:
plugins = [n for n in plugins if manifest[n].category == category]
if len(plugins) == 0:
error('No plugins are available!')
error('No modules are available!')
return []
important('Plugins available for download:', EMPHASIS)
important('Modules available for download:', EMPHASIS)
if category is not None:
info(f' (Only showing plugins in the [{category}] category)')
info(f' (Only showing modules in the [{category}] category)')
for i, name in enumerate(plugins, 1):
plugin = manifest[name]
......@@ -167,10 +167,10 @@ def selectPlugins(manifest : Manifest, category : str = None) -> List[Plugin]:
plugins = _selectOnePlugin(plugins[0])
if len(plugins) == 0:
important('No plugins selected for installation!', EMPHASIS)
important('No modules selected for installation!', EMPHASIS)
return []
important('Plugins selected for installation:', EMPHASIS)
important('Modules selected for installation:', EMPHASIS)
for p in plugins:
info(f' {p}', EMPHASIS)
......@@ -201,9 +201,9 @@ def _perPluginDestination(plugins : List[Plugin]):
"""
question('Select the installation directory '
'for each plugin.', EMPHASIS)
'for each module.', EMPHASIS)
info('Press enter to accept the default installation '
'directory for a plugin.', indent=2)
'directory for a module.', indent=2)
for plugin in plugins:
......@@ -232,12 +232,12 @@ def confirmDestination(plugins : List[Plugin]):
assert len(plugins) > 0
assert all([p.destination is not None for p in plugins])
instr = 'type the path into which you would like all plugins to be ' \
instr = 'type the path into which you would like all modules to be ' \
'installed, or type "customise" or "c" to set the installation ' \
'directory separately for each plugin.'
'directory separately for each module.'
question('Where would you like the plugins to be installed?', EMPHASIS)
info('If you press enter without typing anything, the plugins will be '
question('Where would you like the modules to be installed?', EMPHASIS)
info('If you press enter without typing anything, the modules will be '
'installed to the default destinations listed below. Otherwise, '
f'{instr}', indent=2, wrap=True)
important('Default installation directories:', EMPHASIS)
......
......@@ -160,11 +160,11 @@ def parseArgs(argv : List[str]) -> argparse.Namespace:
if args.destination is not None:
if len(args.destination) not in (1, len(args.plugin)):
parser.error('The --destination option must either be specified '
'exactly once, or once for every requested plugin.')
'exactly once, or once for every requested module.')
if args.force and len(args.plugin) == 0:
parser.error('The --force option may only be used when you specify '
'which plugins to install on the command line.')
'which module to install on the command line.')
# make all destination paths absolute,
# and support tilde/envvar expansion
......@@ -198,7 +198,7 @@ def loadManifest(args : argparse.Namespace) -> Tuple[plgman.Manifest,
plugins[i] = manifest.addPlugin(p)
if (len(plugins) == 0) and (len(manifest) == 0):
raise RuntimeError('No plugins listed in manifest '
raise RuntimeError('No modules listed in manifest '
'or requested on command-line!')
# if user specified destination(s) on the
......@@ -271,7 +271,7 @@ def download(args : argparse.Namespace, plugins : List[plgman.Plugin]):
to download.
"""
important(f'Downloading {len(plugins)} plugin files...', EMPHASIS)
important(f'Downloading {len(plugins)} module files...', EMPHASIS)
info('If you would like to stop a download, you can press "CTRL+C" '
'to exit. You can then re-run fsl_add_module at a later point '
'in time to resume the download.', indent=2, wrap=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment