Skip to content
Snippets Groups Projects
Commit 0a1858c3 authored by Eleni Mathioulaki's avatar Eleni Mathioulaki
Browse files

don't modify spack.yaml if no site-specific spack.yaml exists

parent cb4d4d24
No related branches found
No related tags found
2 merge requests!368create new experimental release,!367Add site specific configs
......@@ -57,8 +57,6 @@ spack env activate $EBRAINS_SPACK_ENV
# update environment site-configs
rm -rf $SPACK_ENV/site-config && cp -r $EBRAINS_REPO/site-config $SPACK_ENV
# update spack.yaml: merge top-level and site-specific spack.yaml files
# TODO: find a more robust way to do this (maybe with yq? but we need to download the binary)
# TODO: or add pyyaml to dependencies and use python script
spack-python $EBRAINS_REPO/site-config/ymerge.py $EBRAINS_REPO/spack.yaml $EBRAINS_REPO/site-config/$SYSTEMNAME/spack.yaml > /tmp/spack.yaml
cp /tmp/spack.yaml $SPACK_ENV/
......
import sys
# spack-python script that merges two environment configuration files (spack.yaml) into one
# Usage: spack-python /path/to/first/spack.yaml /path/to/second/spack.yaml
# (note: if the second file does not exist, the output is the first file
import sys, os
from spack.config import merge_yaml, read_config_file, syaml
print(syaml.dump(merge_yaml(read_config_file(sys.argv[1]), read_config_file(sys.argv[2]))))
if not os.path.exists(sys.argv[2]):
merged = syaml.dump(read_config_file(sys.argv[1]))
else:
merged = syaml.dump(merge_yaml(read_config_file(sys.argv[1]), read_config_file(sys.argv[2])))
print(merged)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment