Skip to content
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

always take into account builddependencies when generating template values, also when we're not iterating over builddependencies #3346

Merged
merged 12 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,7 @@ def _finalize_dependencies(self):
def generate_template_values(self):
"""Try to generate all template values."""

self.log.info("Generating template values...")
self._generate_template_values()

# recursive call, until there are no more changes to template values;
Expand All @@ -1611,6 +1612,8 @@ def generate_template_values(self):
# KeyError's may occur when not all templates are defined yet, but these are safe to ignore
pass

self.log.info("Template values: %s", ', '.join("%s='%s'" % x for x in sorted(self.template_values.items())))

def _generate_template_values(self, ignore=None):
"""Actual code to generate the template values"""

Expand Down
22 changes: 19 additions & 3 deletions easybuild/framework/easyconfig/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,25 @@ 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', []))

# only consider build dependencies for defining *ver and *shortver templates if we're in iterative mode
if hasattr(config, 'iterating') and config.iterating:
deps += config.get('builddependencies', [])
# 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...);
# we need to know to determine whether we're iterating over a list of build dependencies
is_easyconfig = hasattr(config, 'iterating') and hasattr(config, 'iterate_options')

if is_easyconfig:
# if we're iterating over 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', [])

for dep in deps:
if isinstance(dep, dict):
Expand Down
2 changes: 2 additions & 0 deletions test/framework/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,8 @@ def test_templating(self):
' ("Java", "1.7.80"),'
' ("Perl", "5.22.0"),'
' ("Python", "2.7.10"),'
']',
'builddependencies = ['
' ("R", "3.2.3"),'
']',
'modloadmsg = "%s"' % '; '.join([
Expand Down