Skip to content

add support for alternative EasyBuild configuration options (WIP) #4556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ def terminal_supports_colors(stream):
return False


# alternative names for EasyBuild configuration options;
# format: '<new-and-better-name>': '<old-and-soon-to-be-deprecated-name>'
ALTERNATIVE_EASYBUILD_CONFIGURATION_OPTIONS = {
'build-path': 'buildpath',
}

CONFIG_ENV_VAR_PREFIX = 'EASYBUILD'

XDG_CONFIG_HOME = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), ".config"))
Expand Down Expand Up @@ -207,6 +213,18 @@ def use_color(colorize, stream=sys.stdout):
return False


def add_alternate_options(opts):
"""
Add alternative names to provided dictionary of configuration options
"""
rev_map_alt_cfg_opts = {v: k for k, v in ALTERNATIVE_EASYBUILD_CONFIGURATION_OPTIONS.items()}
for key in rev_map_alt_cfg_opts:
if key in opts:
alt_key = rev_map_alt_cfg_opts[key]
alt_descr = opts[key][0] + f" (alternative for --{key})"
opts[alt_key] = (alt_descr,) + opts[key][1:]


class EasyBuildOptions(GeneralOption):
"""Easybuild generaloption class"""
VERSION = this_is_easybuild()
Expand Down Expand Up @@ -550,7 +568,7 @@ def config_options(self):
None, "store_true", False,),
'avail-repositories': ("Show all repository types (incl. non-usable)",
None, "store_true", False,),
'buildpath': ("Temporary build path", None, 'store', mk_full_default_path('buildpath')),
'buildpath': ("Path for temporary build directories", None, 'store', mk_full_default_path('buildpath')),
'containerpath': ("Location where container recipe & image will be stored", None, 'store',
mk_full_default_path('containerpath')),
'envvars-user-modules': ("List of environment variables that hold the base paths for which user-specific "
Expand Down Expand Up @@ -625,6 +643,8 @@ def config_options(self):
'tmpdir': ('Directory to use for temporary storage', None, 'store', None),
})

add_alternate_options(opts)

self.log.debug("config_options: descr %s opts %s" % (descr, opts))
self.add_group_parser(opts, descr)

Expand Down
Loading