Skip to content

Commit 1a5ed61

Browse files
committed
Create copy for all options in ITERATE_OPTS-iterate_opts
This way each iteration will start from the original copy of configopts etc, as it's in the iter_opts dict.
1 parent cc96e4e commit 1a5ed61

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

easybuild/framework/easyblock.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,24 +2378,21 @@ def handle_iterate_opts(self):
23782378
# handle configure/build/install options that are specified as lists (+ perhaps builddependencies)
23792379
# set first element to be used, keep track of list in self.iter_opts
23802380
# only needs to be done during first iteration, since after that the options won't be lists anymore
2381-
if self.iter_idx == 0:
2381+
if self.iter_idx == 0 and self.det_iter_cnt() > 1:
23822382
# keep track of list, supply first element as first option to handle
2383-
iter_cnt = self.det_iter_cnt()
2384-
for opt in self.cfg.iterate_options:
2385-
if isinstance(self.cfg[opt], (list, tuple)):
2386-
self.iter_opts[opt] = self.cfg[opt] # copy
2387-
elif iter_cnt > 1:
2388-
# make iter_cnt copies for every opt since easyblocks can modify them
2389-
self.iter_opts[opt] = [self.cfg[opt]] * iter_cnt
2390-
self.log.debug("Found list for %s: %s", opt, self.iter_opts[opt])
2383+
for opt in self.cfg.ITERATE_OPTIONS:
2384+
self.iter_opts[opt] = self.cfg[opt] # copy
2385+
self.log.debug("Iterating opt %s: %s", opt, self.iter_opts[opt])
23912386

23922387
if self.iter_opts:
23932388
print_msg("starting iteration #%s ..." % self.iter_idx, log=self.log, silent=self.silent)
23942389
self.log.info("Current iteration index: %s", self.iter_idx)
23952390

23962391
# pop first element from all iterative easyconfig parameters as next value to use
23972392
for opt, value in self.iter_opts.items():
2398-
if len(value) > self.iter_idx:
2393+
if opt not in self.cfg.iterate_options:
2394+
self.cfg[opt] = value
2395+
elif len(value) > self.iter_idx:
23992396
self.cfg[opt] = value[self.iter_idx]
24002397
else:
24012398
self.cfg[opt] = '' # empty list => empty option as next value

easybuild/framework/easyconfig/easyconfig.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,14 @@ def validate_iterate_opts_lists(self):
10371037
def start_iterating(self):
10381038
"""Start iterative mode."""
10391039

1040-
# builddependencies is already handled, see __init__
1041-
self.iterate_options.extend([opt for opt in ITERATE_OPTIONS if opt != 'builddependencies'])
1040+
for opt in ITERATE_OPTIONS:
1041+
# builddpendencies is already handled, see __init__
1042+
if opt == 'builddependencies':
1043+
continue
1044+
1045+
# list of values indicates that this is a value to iterate over
1046+
if isinstance(self[opt], (list, tuple)):
1047+
self.iterate_options.append(opt)
10421048

10431049
# keep track of when we're iterating (used by builddependencies())
10441050
self.iterating = True

0 commit comments

Comments
 (0)