@@ -308,17 +308,17 @@ def generate(self, recipe):
308308 # the packages.yaml configuration that will be used when building all environments
309309 # - the system packages.yaml with gcc removed
310310 # - plus additional packages provided by the recipe
311- global_packages_yaml = yaml . dump ( recipe . packages [ "global" ])
311+
312312 global_packages_path = config_path / "packages.yaml"
313313 with global_packages_path .open ("w" ) as fid :
314- fid . write ( global_packages_yaml )
314+ yaml . dump ( recipe . packages [ "global" ], fid )
315315
316316 # generate a mirrors.yaml file if build caches have been configured
317317 if recipe .mirror :
318318 dst = config_path / "mirrors.yaml"
319319 self ._logger .debug (f"generate the build cache mirror: { dst } " )
320320 with dst .open ("w" ) as fid :
321- fid . write ( cache .generate_mirrors_yaml (recipe .mirror ) )
321+ cache .generate_mirrors_yaml (recipe .mirror , fid )
322322
323323 # Add custom spack package recipes, configured via Spack repos.
324324 # Step 1: copy Spack repos to store_path where they will be used to
@@ -439,7 +439,10 @@ def generate(self, recipe):
439439 compiler_config_path .mkdir (exist_ok = True )
440440 for file , raw in files .items ():
441441 with (compiler_config_path / file ).open (mode = "w" ) as f :
442- f .write (raw )
442+ if type (raw ) is str :
443+ f .write (raw )
444+ else :
445+ yaml .dump (raw , f )
443446
444447 # generate the makefile and spack.yaml files that describe the environments
445448 environment_files = recipe .environment_files
@@ -473,11 +476,10 @@ def generate(self, recipe):
473476 )
474477
475478 # write modules/modules.yaml
476- modules_yaml = recipe .modules_yaml
477479 generate_modules_path = self .path / "modules"
478480 generate_modules_path .mkdir (exist_ok = True )
479481 with (generate_modules_path / "modules.yaml" ).open ("w" ) as f :
480- f . write ( modules_yaml )
482+ yaml . dump ( recipe . modules_yaml_data , f )
481483
482484 # write the meta data
483485 meta_path = store_path / "meta"
0 commit comments