@@ -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 ):
0 commit comments