Skip to content
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
17 changes: 15 additions & 2 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2508,10 +2508,23 @@ def fix_deprecated_easyconfigs(paths):
# fix use of local variables with a name other than a single letter or 'local_*'
ec = EasyConfig(path, local_var_naming_check=LOCAL_VAR_NAMING_CHECK_LOG)
for key in ec.unknown_keys:
regexp = re.compile(r'\b(%s)\b' % key)
ectxt = regexp.sub(LOCAL_VAR_PREFIX + key, ectxt)
regex = re.compile(r'\b(%s)\b' % key)
ectxt = regex.sub(LOCAL_VAR_PREFIX + key, ectxt)
fixed = True

# replace renamed easyconfig parameters
for (new_param, old_param) in ALTERNATE_PARAMETERS.items():
# top-level easyconfig parameters
regex = re.compile(rf'^{old_param}\s*=\s*', re.M)
if regex.search(ectxt):
ectxt = regex.sub(rf'{new_param} = ', ectxt)
fixed = True
# parameters set for extensions
regex = re.compile(rf"""^(\s*["']){old_param}(["']\s*:\s*)""", re.M)
if regex.search(ectxt):
ectxt = regex.sub(rf"\1{new_param}\2", ectxt)
fixed = True

if fixed:
fixed_cnt += 1
backup_path = find_backup_name_candidate(path + '.orig')
Expand Down