Skip to content

Commit

Permalink
Merge pull request #1 from boegel/template_builddependencies
Browse files Browse the repository at this point in the history
also consider builddependencies when config passed to template_constant_dict is not an EasyConfig instance yet + add comments to clarify what's going on
  • Loading branch information
ekouts authored Jul 3, 2020
2 parents ac27f21 + 36c95a4 commit d5945bb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion easybuild/framework/easyconfig/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,30 @@ def template_constant_dict(config, ignore=None, skip_lower=None, toolchain=None)
# copy to avoid changing original list below
deps = copy.copy(config.get('dependencies', []))

if hasattr(config, 'iterating'):
# also consider build dependencies for *ver and *shortver templates;
# we need to be a bit careful here, because for iterative installations
# (when multi_deps is used for example) the builddependencies value may be a list of lists

# first, determine if we have an EasyConfig instance
# (indirectly by checking for 'iterating' and 'iterate_options' attributes,
# because we can't import the EasyConfig class here without introducing
# a cyclic import...)
is_easyconfig = hasattr(config, 'iterating') and hasattr(config, 'iterate_options')

if is_easyconfig:
# if we're iterating of different lists of build dependencies,
# only consider build dependencies when we're actually in iterative mode!
if 'builddependencies' in config.iterate_options:
if config.iterating:
deps += config.get('builddependencies', [])
else:
deps += config.get('builddependencies', [])

# if we're not dealing with an EasyConfig instance,
# we can just add list of builddependencies directly (no list of lists in that case)
else:
deps += config.get('builddependencies', [])

for dep in deps:
if isinstance(dep, dict):
dep_name, dep_version = dep['name'], dep['version']
Expand Down

0 comments on commit d5945bb

Please sign in to comment.