Skip to content

Commit eedcfc8

Browse files
authored
Merge pull request #3346 from ekouts/template_builddependencies
always take into account builddependencies when generating template values, also when we're not iteraring over builddependencies
2 parents 5f69825 + 44b03c5 commit eedcfc8

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

easybuild/framework/easyconfig/easyconfig.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,7 @@ def _finalize_dependencies(self):
15931593
def generate_template_values(self):
15941594
"""Try to generate all template values."""
15951595

1596+
self.log.info("Generating template values...")
15961597
self._generate_template_values()
15971598

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

1615+
self.log.info("Template values: %s", ', '.join("%s='%s'" % x for x in sorted(self.template_values.items())))
1616+
16141617
def _generate_template_values(self, ignore=None):
16151618
"""Actual code to generate the template values"""
16161619

easybuild/framework/easyconfig/templates.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,25 @@ def template_constant_dict(config, ignore=None, skip_lower=None, toolchain=None)
216216
# copy to avoid changing original list below
217217
deps = copy.copy(config.get('dependencies', []))
218218

219-
# only consider build dependencies for defining *ver and *shortver templates if we're in iterative mode
220-
if hasattr(config, 'iterating') and config.iterating:
221-
deps += config.get('builddependencies', [])
219+
# also consider build dependencies for *ver and *shortver templates;
220+
# we need to be a bit careful here, because for iterative installations
221+
# (when multi_deps is used for example) the builddependencies value may be a list of lists
222+
223+
# first, determine if we have an EasyConfig instance
224+
# (indirectly by checking for 'iterating' and 'iterate_options' attributes,
225+
# because we can't import the EasyConfig class here without introducing
226+
# a cyclic import...);
227+
# we need to know to determine whether we're iterating over a list of build dependencies
228+
is_easyconfig = hasattr(config, 'iterating') and hasattr(config, 'iterate_options')
229+
230+
if is_easyconfig:
231+
# if we're iterating over different lists of build dependencies,
232+
# only consider build dependencies when we're actually in iterative mode!
233+
if 'builddependencies' in config.iterate_options:
234+
if config.iterating:
235+
deps += config.get('builddependencies', [])
236+
else:
237+
deps += config.get('builddependencies', [])
222238

223239
for dep in deps:
224240
if isinstance(dep, dict):

test/framework/easyconfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,8 @@ def test_templating(self):
965965
' ("Java", "1.7.80"),'
966966
' ("Perl", "5.22.0"),'
967967
' ("Python", "2.7.10"),'
968+
']',
969+
'builddependencies = ['
968970
' ("R", "3.2.3"),'
969971
']',
970972
'modloadmsg = "%s"' % '; '.join([

0 commit comments

Comments
 (0)