@@ -309,17 +309,17 @@ def generate(self, recipe):
309309 # the packages.yaml configuration that will be used when building all environments
310310 # - the system packages.yaml with gcc removed
311311 # - plus additional packages provided by the recipe
312- global_packages_yaml = yaml . dump ( recipe . packages [ "global" ])
312+
313313 global_packages_path = config_path / "packages.yaml"
314314 with global_packages_path .open ("w" ) as fid :
315- fid . write ( global_packages_yaml )
315+ yaml . dump ( recipe . packages [ "global" ], fid )
316316
317317 # generate a mirrors.yaml file if build caches have been configured
318318 if recipe .mirror :
319319 dst = config_path / "mirrors.yaml"
320320 self ._logger .debug (f"generate the build cache mirror: { dst } " )
321321 with dst .open ("w" ) as fid :
322- fid . write ( cache .generate_mirrors_yaml (recipe .mirror ) )
322+ cache .generate_mirrors_yaml (recipe .mirror , fid )
323323
324324 # Add custom spack package recipes, configured via Spack repos.
325325 # Step 1: copy Spack repos to store_path where they will be used to
@@ -440,7 +440,10 @@ def generate(self, recipe):
440440 compiler_config_path .mkdir (exist_ok = True )
441441 for file , raw in files .items ():
442442 with (compiler_config_path / file ).open (mode = "w" ) as f :
443- f .write (raw )
443+ if type (raw ) is str :
444+ f .write (raw )
445+ else :
446+ yaml .dump (raw , f )
444447
445448 # generate the makefile and spack.yaml files that describe the environments
446449 environment_files = recipe .environment_files
@@ -479,7 +482,7 @@ def generate(self, recipe):
479482 generate_modules_path = self .path / "modules"
480483 generate_modules_path .mkdir (exist_ok = True )
481484 with (generate_modules_path / "modules.yaml" ).open ("w" ) as f :
482- yaml .dump (recipe .modules , f )
485+ yaml .dump (recipe .modules_yaml_data , f )
483486
484487 # write the meta data
485488 meta_path = store_path / "meta"
0 commit comments