Skip to content

Commit

Permalink
Don't resolve templates where it isn't required
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Apr 17, 2020
1 parent 715f7c0 commit 91c7f0d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
9 changes: 5 additions & 4 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,8 @@ def make_module_extra_extensions(self):
lines = [self.module_extra_extensions]

# set environment variable that specifies list of extensions
exts_list = ','.join(['%s-%s' % (ext[0], ext[1]) for ext in self.cfg['exts_list']])
# We need only name and version, so don't resolve templates
exts_list = ','.join(['-'.join(ext[:2]) for ext in self.cfg.get_ref('exts_list')])
env_var_name = convert_name(self.name, upper=True)
lines.append(self.module_generator.set_environment('EBEXTSLIST%s' % env_var_name, exts_list))

Expand All @@ -1207,7 +1208,7 @@ def make_module_footer(self):
footer = [self.module_generator.comment("Built with EasyBuild version %s" % VERBOSE_VERSION)]

# add extra stuff for extensions (if any)
if self.cfg['exts_list']:
if self.cfg.get_ref('exts_list'):
footer.append(self.make_module_extra_extensions())

# include modules footer if one is specified
Expand Down Expand Up @@ -1791,7 +1792,7 @@ def fetch_step(self, skip_checksums=False):
trace_msg(msg)

# fetch extensions
if self.cfg['exts_list']:
if self.cfg.get_ref('exts_list'):
self.exts = self.fetch_extension_sources(skip_checksums=skip_checksums)

# create parent dirs in install and modules path already
Expand Down Expand Up @@ -2063,7 +2064,7 @@ def extensions_step(self, fetch=False):
- find source for extensions, in 'extensions' (and 'packages' for legacy reasons)
- run extra_extensions
"""
if len(self.cfg['exts_list']) == 0:
if not self.cfg.get_ref('exts_list'):
self.log.debug("No extensions in exts_list")
return

Expand Down
8 changes: 4 additions & 4 deletions easybuild/framework/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def __init__(self, mself, ext, extra_params=None):
# make sure they are merged into self.cfg so they can be queried;
# unknown easyconfig parameters are ignored since self.options may include keys only there for extensions;
# this allows to specify custom easyconfig parameters on a per-extension basis
for key in self.options:
for key, value in self.options.items():
if key in self.cfg:
self.cfg[key] = resolve_template(self.options[key], self.cfg.template_values)
self.cfg[key] = value
self.log.debug("Customising known easyconfig parameter '%s' for extension %s/%s: %s",
key, name, version, self.cfg[key])
key, name, version, value)
else:
self.log.debug("Skipping unknown custom easyconfig parameter '%s' for extension %s/%s: %s",
key, name, version, self.options[key])
key, name, version, value)

self.sanity_check_fail_msgs = []

Expand Down
3 changes: 2 additions & 1 deletion easybuild/tools/module_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ def _generate_extension_list(self):
"""
Generate a string with a comma-separated list of extensions.
"""
exts_list = self.app.cfg['exts_list']
# We need only name and version, so don't resolve templates
exts_list = self.app.cfg.get_ref('exts_list')
extensions = ', '.join(sorted(['-'.join(ext[:2]) for ext in exts_list], key=str.lower))

return extensions
Expand Down
3 changes: 1 addition & 2 deletions test/framework/tweak.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,7 @@ def test_map_easyconfig_to_target_tc_hierarchy(self):
update_build_specs={'version': new_version},
update_dep_versions=False)
tweaked_ec = process_easyconfig(tweaked_spec)[0]
tweaked_dict = tweaked_ec['ec'].asdict()
extensions = tweaked_dict['exts_list']
extensions = tweaked_ec['ec']['exts_list']
# check one extension with the same name exists and that the version has been updated
hit_extension = 0
for extension in extensions:
Expand Down

0 comments on commit 91c7f0d

Please sign in to comment.